Comment 9 for bug 957561

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

r918: This problem seems to have gone away on my Mac, but it's still there under Windows. For example, if I open a script file containing the text:

print "Hi, Richard"

and press C-c C-c, I get an error dump again (see below). It's trying to switch to a buffer called *IPython*, while the actual buffer name is *c:/python27/Scripts/IPython.bat*

The dump is as follows:

Debugger entered--Lisp error: (error "No buffer named *IPython*")
  set-buffer("*IPython*")
  (cond ((unless (eq switch (quote noswitch)) (and py-split-windows-on-execute-p (or (eq switch (quote switch)) py-shell-switch-buffers-on-execute-p))) (unless (string-match "[Ii][Pp]ython" py-buffer-name) (delete-other-windows)) (when (window-full-height-p) (funcall py-split-windows-on-execute-function)) (pop-to-buffer py-buffer-name)) ((and py-split-windows-on-execute-p (or (eq switch (quote noswitch)) (not (eq switch (quote switch))))) (when (window-full-height-p) (funcall py-split-windows-on-execute-function)) (set-buffer py-buffer-name) (switch-to-buffer (current-buffer)) (other-window 1)) ((or (eq switch (quote switch)) (and (not (eq switch (quote noswitch))) py-shell-switch-buffers-on-execute-p)) (pop-to-buffer py-buffer-name) (goto-char (point-max))) ((or (eq switch (quote noswitch)) (not py-shell-switch-buffers-on-execute-p)) (set-buffer oldbuf) (switch-to-buffer (current-buffer))))
  py-shell-manage-windows(nil t nil #<buffer run.py> "*IPython*")
  (progn (when (string-match "ipython" (process-name proc)) (sit-for py-ipython-execute-delay)) (setq erg (py-execute-file-base proc file pec)) (setq py-exception-buffer (cons file (current-buffer))) (py-shell-manage-windows switch py-split-windows-on-execute-p py-shell-switch-buffers-on-execute-p oldbuf procbuf) (unless (string= (buffer-name (current-buffer)) procbuf) (when py-verbose-p (message "Output buffer: %s" procbuf))) (sit-for 0.1) (unless py-execute-keep-temporary-file-p (delete-file file) (when (buffer-live-p file) (kill-buffer file))) erg)
  (if (file-readable-p file) (progn (when (string-match "ipython" (process-name proc)) (sit-for py-ipython-execute-delay)) (setq erg (py-execute-file-base proc file pec)) (setq py-exception-buffer (cons file (current-buffer))) (py-shell-manage-windows switch py-split-windows-on-execute-p py-shell-switch-buffers-on-execute-p oldbuf procbuf) (unless (string= (buffer-name (current-buffer)) procbuf) (when py-verbose-p (message "Output buffer: %s" procbuf))) (sit-for 0.1) (unless py-execute-keep-temporary-file-p (delete-file file) (when (buffer-live-p file) (kill-buffer file))) erg) (message "%s not readable. %s" file "Do you have write permissions?"))
  (let* ((oldbuf (current-buffer)) (shell (or shell (py-choose-shell))) (regbuf (current-buffer)) (py-execute-directory (or (ignore-errors (file-name-directory (buffer-file-name))) (getenv "WORKON_HOME") (getenv "HOME"))) (strg (buffer-substring-no-properties start end)) (sepchar (or sepchar (py-separator-char))) (name (py-buffer-name-prepare shell sepchar)) (temp (make-temp-name shell)) (file (concat (expand-file-name temp py-temp-directory) ".py")) (filebuf (get-buffer-create file)) (proc (if dedicated (get-buffer-process (py-shell nil dedicated (or shell (downcase shell)) switch sepchar nil t)) (or (get-buffer-process shell) (get-buffer-process (py-shell nil dedicated (or shell ...) switch sepchar nil t))))) (procbuf (if dedicated (buffer-name (get-buffer (current-buffer))) (py-process-name name dedicated nostars sepchar))) (pec (if (string-match "Python *3" name) (format "exec(compile(open('%s').read(), '%s', 'exec')) # PYTHON-MODE\n" file file) (format "execfile(r'%s') # PYTHON-MODE\n" file))) (wholebuf (when (boundp (quote wholebuf)) wholebuf)) (comint-scroll-to-bottom-on-output t) erg) (set-buffer filebuf) (erase-buffer) (insert strg) (unless wholebuf (py-fix-start (point-min) (point-max)) (py-if-needed-insert-shell name) (py-insert-coding) (py-insert-execute-directory)) (set-buffer filebuf) (write-region (point-min) (point-max) file nil t nil (quote ask)) (set-buffer-modified-p (quote nil)) (kill-buffer filebuf) (if (file-readable-p file) (progn (when (string-match "ipython" (process-name proc)) (sit-for py-ipython-execute-delay)) (setq erg (py-execute-file-base proc file pec)) (setq py-exception-buffer (cons file (current-buffer))) (py-shell-manage-windows switch py-split-windows-on-execute-p py-shell-switch-buffers-on-execute-p oldbuf procbuf) (unless (string= (buffer-name (current-buffer)) procbuf) (when py-verbose-p (message "Output buffer: %s" procbuf))) (sit-for 0.1) (unless py-execute-keep-temporary-file-p (delete-file file) (when (buffer-live-p file) (kill-buffer file))) erg) (message "%s not readable. %s" file "Do you have write permissions?")))
  py-execute-base(1 21 nil nil nil)
  (let ((shell (cond ((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 shell dedicated switch))
  py-execute-region(1 21 nil nil nil)
  (let ((wholebuf t) (py-master-file (or py-master-file (py-fetch-py-master-file))) beg end) (when py-master-file (let* ((filename (expand-file-name py-master-file)) (buffer (or (get-file-buffer filename) (find-file-noselect filename)))) (set-buffer buffer))) (setq beg (point-min)) (setq end (point-max)) (py-execute-region beg end shell dedicated switch))
  (save-excursion (let ((wholebuf t) (py-master-file (or py-master-file (py-fetch-py-master-file))) beg end) (when py-master-file (let* ((filename (expand-file-name py-master-file)) (buffer (or (get-file-buffer filename) (find-file-noselect filename)))) (set-buffer buffer))) (setq beg (point-min)) (setq end (point-max)) (py-execute-region beg end shell dedicated switch)))
  py-execute-buffer(nil)
  call-interactively(py-execute-buffer nil nil)