r1288: Error trying to run code with C-c C-c

Bug #1207015 reported by Richard Stanton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

Under OS X, Emacs 24.3, using Anaconda python2.7, when I press C-c C-c to execute my python code, I get the following error:

Debugger entered--Lisp error: (void-variable proc)
  (process-name proc)
  (string-match "ipython" (process-name proc))
  (if (string-match "ipython" (process-name proc)) (progn (sit-for py-ipython-execute-delay)))
  (progn (if (string-match "ipython" (process-name proc)) (progn (sit-for py-ipython-execute-delay))) (setq erg (py-execute-file-base nil file)) (sit-for 0.2) (if (string-match (concat py-pdbtrack-input-prompt "\\|" py-pydbtrack-input-prompt) erg) (set-buffer procbuf) (setq err-p (py-postprocess-output-buffer procbuf py-exception-buffer)) (if err-p (progn (setnth 1 err-p (1- (nth 1 err-p))) (py-jump-to-exception err-p py-exception-buffer)) (py-shell-manage-windows py-buffer-name)) (if (string= (buffer-name (current-buffer)) (buffer-name procbuf)) nil (if py-verbose-p (progn (message "Output buffer: %s" procbuf))))))
  (if (file-readable-p file) (progn (if (string-match "ipython" (process-name proc)) (progn (sit-for py-ipython-execute-delay))) (setq erg (py-execute-file-base nil file)) (sit-for 0.2) (if (string-match (concat py-pdbtrack-input-prompt "\\|" py-pydbtrack-input-prompt) erg) (set-buffer procbuf) (setq err-p (py-postprocess-output-buffer procbuf py-exception-buffer)) (if err-p (progn (setnth 1 err-p (1- (nth 1 err-p))) (py-jump-to-exception err-p py-exception-buffer)) (py-shell-manage-windows py-buffer-name)) (if (string= (buffer-name (current-buffer)) (buffer-name procbuf)) nil (if py-verbose-p (progn (message "Output buffer: %s" procbuf)))))) (message "%s not readable. %s" file "Do you have permissions?"))
  py-execute-buffer-file(nil "/Users/stanton/projects/test/python/amput.py")
  (cond (python-mode-v5-behavior-p (py-execute-python-mode-v5 start end)) (py-execute-no-temp-p (py-execute-ge24\.3 start end py-dedicated-process-p file)) ((and (not (buffer-modified-p)) file) (py-execute-buffer-file py-dedicated-process-p file)) (t (py-execute-buffer-finally start end py-dedicated-process-p)))
  (let* ((windows-config (window-configuration-to-register 313465889)) (windows-displayed (window-list-1)) (py-shell-name (or py-shell-name (py-choose-shell))) (py-exception-buffer (current-buffer)) (execute-directory (cond ((condition-case nil (progn (file-name-directory ...)) (error nil))) ((and py-use-current-dir-when-execute-p (buffer-file-name)) (file-name-directory (buffer-file-name))) ((and py-use-current-dir-when-execute-p py-fileless-buffer-use-default-directory-p) (expand-file-name default-directory)) ((stringp py-execute-directory) py-execute-directory) ((getenv "VIRTUAL_ENV")) (t (getenv "HOME")))) (py-buffer-name (or py-buffer-name (py-buffer-name-prepare))) (py-orig-buffer-or-file (current-buffer))) (cond (python-mode-v5-behavior-p (py-execute-python-mode-v5 start end)) (py-execute-no-temp-p (py-execute-ge24\.3 start end py-dedicated-process-p file)) ((and (not (buffer-modified-p)) file) (py-execute-buffer-file py-dedicated-process-p file)) (t (py-execute-buffer-finally start end py-dedicated-process-p))))
  py-execute-base(1 1415 nil "/Users/stanton/projects/test/python/amput.py")
  (let ((py-shell-name (cond ((or py-force-local-shell-p py-force-py-shell-name-p) py-shell-name) ((or py-force-py-shell-name-p (eq 4 (prefix-numeric-value shell))) (default-value (quote py-shell-name))) ((and (numberp shell) (not (eq 1 ...))) (read-from-minibuffer "(path-to-)shell-name: " (default-value (quote py-shell-name)))) (t shell)))) (py-execute-base start end py-dedicated-process-p file))
  py-execute-region(1 1415 nil nil "/Users/stanton/projects/test/python/amput.py")
  (let* ((wholebuf t) (py-master-file (or py-master-file (py-fetch-py-master-file))) (file (or file (if py-master-file (prog1 (expand-file-name py-master-file) (set-buffer (or ... ...)))) (buffer-file-name))) (beg (point-min)) (end (point-max))) (py-execute-region beg end shell py-dedicated-process-p file))
  py-execute-buffer(nil)
  call-interactively(py-execute-buffer nil nil)

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → Medium
milestone: none → 6.1.3
milestone: 6.1.3 → 6.1.2
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi Richard,

thanks for the report. Could not reproduce. Several things changed meanwhile. If you get the error still with trunk of today, please send some example code.

Andreas

Revision history for this message
Richard Stanton (a-stanton) wrote :
Download full text (3.7 KiB)

Using today's trunk and the simplest possible Python file (no shebang),

------

a = 3

-----

I now get:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  set-buffer(nil)
  (save-excursion (set-buffer buf) (goto-char (point-max)) (forward-line -1) (end-of-line) (save-excursion (if (re-search-backward py-shell-prompt-regexp nil t 1) (progn (and (re-search-forward "File \"<stdin>\", line 1,.*\n" nil t) (replace-match "")) (if (and (re-search-forward py-traceback-line-re limit t) (or (match-string 1) (match-string 3))) (progn (if (match-string-no-properties 1) (progn ... ... ... ... ...)) (add-to-list (quote err-p) line) (add-to-list (quote err-p) file) (overlay-put (make-overlay ... ...) (quote face) (quote highlight)) (forward-line 1) (if (looking-at "[ ]*\\([^ \n
\f]+\\)[ ]*$") (progn ... ... ... ... ...)))) err-p))))
  (let (line file bol err-p estring ecode limit) (save-excursion (set-buffer buf) (goto-char (point-max)) (forward-line -1) (end-of-line) (save-excursion (if (re-search-backward py-shell-prompt-regexp nil t 1) (progn (and (re-search-forward "File \"<stdin>\", line 1,.*\n" nil t) (replace-match "")) (if (and (re-search-forward py-traceback-line-re limit t) (or ... ...)) (progn (if ... ...) (add-to-list ... line) (add-to-list ... file) (overlay-put ... ... ...) (forward-line 1) (if ... ...))) err-p)))))
  py-postprocess-output-buffer(nil)
  (setq err-p (py-postprocess-output-buffer py-buffer-name))
  (progn (setq erg (py-execute-file-base nil file nil nil (or (and (boundp (quote py-orig-buffer-or-file)) py-orig-buffer-or-file) file))) (sit-for 0.1) (setq err-p (py-postprocess-output-buffer py-buffer-name)) (if py-enforce-output-buffer-p (progn (set-buffer (get-buffer-create py-output-buffer)) (erase-buffer) (insert erg) (py-shell-manage-windows py-output-buffer nil windows-config err-p)) (py-shell-manage-windows py-buffer-name nil windows-config err-p)) (if py-verbose-p (progn (message "Output buffer: %s" py-buffer-name))) (sit-for 0.1))
  (if (file-readable-p file) (progn (setq erg (py-execute-file-base nil file nil nil (or (and (boundp (quote py-orig-buffer-or-file)) py-orig-buffer-or-file) file))) (sit-for 0.1) (setq err-p (py-postprocess-output-buffer py-buffer-name)) (if py-enforce-output-buffer-p (progn (set-buffer (get-buffer-create py-output-buffer)) (erase-buffer) (insert erg) (py-shell-manage-windows py-output-buffer nil windows-config err-p)) (py-shell-manage-windows py-buffer-name nil windows-config err-p)) (if py-verbose-p (progn (message "Output buffer: %s" py-buffer-name))) (sit-for 0.1)) (message "%s not readable. %s" file "Do you have write permissions?"))
  (let ((windows-config (window-configuration-to-register 313465889)) erg err-p) (if (file-readable-p file) (progn (setq erg (py-execute-file-base nil file nil nil (or (and (boundp ...) py-orig-buffer-or-file) file))) (sit-for 0.1) (setq err-p (py-postprocess-output-buffer py-buffer-name)) (if py-enforce-output-buffer-p (progn (set-buffer (get-buffer-create py-output-buffer)) (erase-buffer) (insert erg) (py-shell-manage-windows py-output-buffer nil windows-config err-p)) (py-shell-manage-windows py-buffer-name nil windows-config err-p)) (if p...

Read more...

Changed in python-mode:
status: New → In Progress
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Please check again, TIA.

Revision history for this message
Richard Stanton (a-stanton) wrote :

Thanks. It works now, but I do get the error message

Making comint-move-point-for-output local to *ABP Python* while let-bound!

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hmm, thanks for the info. Will close that for now. Please make a new report in case of trouble.

Changed in python-mode:
status: In Progress → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.