An Emacs mode for editing Python code

New error running buffer with C-c C-c

Reported by Richard Stanton on 2013-09-05
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
python-mode.el
High
Andreas Roehler

Bug Description

Running r1305 inside Emacs 24.3 under OS X 10.8.4, I get an error message when I try to execute my python buffer using C-c C-c.

It doesn't seem to matter what the buffer contents are. Here's a very simple example:

---------------
a = 3
---------------

And here's the error buffer when I type C-c C-c:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  count-lines(1 nil)
  (save-restriction (widen) (count-lines (point-min) (or (and (eq start (line-beginning-position)) (not (eobp)) (1+ start)) start)))
  (let* ((windows-config (window-configuration-to-register 313465889)) (origline (save-restriction (widen) (count-lines (point-min) (or (and (eq start ...) (not ...) (1+ start)) start)))) (py-shell-name (or shell (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))) (filename (and filename (expand-file-name filename))) (py-orig-buffer-or-file (or filename (current-buffer))) (proc (or proc (if py-dedicated-process-p (get-buffer-process (py-shell nil py-dedicated-process-p py-shell-name py-buffer-name t)) (or (and (boundp ...) (get-buffer-process py-buffer-name)) (get-buffer-process (py-shell nil py-dedicated-process-p py-shell-name ... t)))))) err-p) (set-buffer py-exception-buffer) (py-update-execute-directory proc py-buffer-name execute-directory) (cond (python-mode-v5-behavior-p (py-execute-python-mode-v5 start end)) (py-execute-no-temp-p (py-execute-ge24\.3 start end filename execute-directory)) ((or file (and (not (buffer-modified-p)) filename)) (py-execute-file-base proc filename nil py-buffer-name filename execute-directory)) (t (py-execute-buffer-finally start end execute-directory))))
  py-execute-base(nil nil nil "/Users/stanton/projects/ESOest/test2.py" nil "/Users/stanton/projects/ESOest/test2.py")
  (setq erg (py-execute-base nil nil nil file nil (or (and (boundp (quote py-orig-buffer-or-file)) py-orig-buffer-or-file) file)))
  (if (file-readable-p file) (setq erg (py-execute-base nil nil nil file nil (or (and (boundp (quote py-orig-buffer-or-file)) py-orig-buffer-or-file) file))) (message "%s not readable. %s" file "Do you have write permissions?"))
  (let (erg) (if (file-readable-p file) (setq erg (py-execute-base nil nil nil file nil (or (and (boundp (quote py-orig-buffer-or-file)) py-orig-buffer-or-file) file))) (message "%s not readable. %s" file "Do you have write permissions?")) erg)
  py-execute-file("/Users/stanton/projects/ESOest/test2.py")
  (let* ((py-master-file (or py-master-file (py-fetch-py-master-file))) (file (if py-master-file (expand-file-name py-master-file) (buffer-file-name)))) (py-execute-file file))
  py-execute-buffer-base()
  (if (buffer-file-name) (py-execute-buffer-base) (py-execute-region (point-min) (point-max)))
  (if (and py-prompt-on-changed-p (buffer-file-name) (interactive-p) (buffer-modified-p)) (if (y-or-n-p "Buffer changed, save first? ") (progn (write-file (buffer-file-name)) (py-execute-buffer-base)) (py-execute-region (point-min) (point-max))) (if (buffer-file-name) (py-execute-buffer-base) (py-execute-region (point-min) (point-max))))
  py-execute-buffer()
  call-interactively(py-execute-buffer nil nil)

Changed in python-mode:
milestone: none → 6.1.3
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → High
status: New → In Progress
Andreas Roehler (a-roehler) wrote :

Checked in a fix. Please tell if done. Thanks!

Changed in python-mode:
status: In Progress → Fix Committed
Download full text (4.3 KiB)

Seems to work now. Thanks for fixing it so fast.

On 9/5/13 11:59 AM, "Andreas Roehler" <email address hidden> wrote:

>Checked in a fix. Please tell if done. Thanks!
>
>** Changed in: python-mode
> Status: In Progress => Fix Committed
>
>--
>You received this bug notification because you are subscribed to the bug
>report.
>https://bugs.launchpad.net/bugs/1221310
>
>Title:
> New error running buffer with C-c C-c
>
>Status in An Emacs mode for editing Python code:
> Fix Committed
>
>Bug description:
> Running r1305 inside Emacs 24.3 under OS X 10.8.4, I get an error
> message when I try to execute my python buffer using C-c C-c.
>
> It doesn't seem to matter what the buffer contents are. Here's a very
> simple example:
>
> ---------------
> a = 3
> ---------------
>
> And here's the error buffer when I type C-c C-c:
>
> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p
>nil)
> count-lines(1 nil)
> (save-restriction (widen) (count-lines (point-min) (or (and (eq start
>(line-beginning-position)) (not (eobp)) (1+ start)) start)))
> (let* ((windows-config (window-configuration-to-register 313465889))
>(origline (save-restriction (widen) (count-lines (point-min) (or (and (eq
>start ...) (not ...) (1+ start)) start)))) (py-shell-name (or shell
>(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))) (filename (and filename
>(expand-file-name filename))) (py-orig-buffer-or-file (or filename
>(current-buffer))) (proc (or proc (if py-dedicated-process-p
>(get-buffer-process (py-shell nil py-dedicated-process-p py-shell-name
>py-buffer-name t)) (or (and (boundp ...) (get-buffer-process
>py-buffer-name)) (get-buffer-process (py-shell nil py-dedicated-process-p
>py-shell-name ... t)))))) err-p) (set-buffer py-exception-buffer)
>(py-update-execute-directory proc py-buffer-name execute-directory) (cond
>(python-mode-v5-behavior-p (py-execute-python-mode-v5 start end))
>(py-execute-no-temp-p (py-execute-ge24\.3 start end filename
>execute-directory)) ((or file (and (not (buffer-modified-p)) filename))
>(py-execute-file-base proc filename nil py-buffer-name filename
>execute-directory)) (t (py-execute-buffer-finally start end
>execute-directory))))
> py-execute-base(nil nil nil "/Users/stanton/projects/ESOest/test2.py"
>nil "/Users/stanton/projects/ESOest/test2.py")
> (setq erg (py-execute-base nil nil nil file nil (or (and (boundp
>(quote py-orig-buffer-or-file)) py-orig-buffer-or-file) file)))
> (if (file-readable-p file) (setq erg (py-execute-base nil nil nil
>file nil (or (and (boundp (quote py-orig-buffer-or-file))
>py-orig-buffer-or-file) file))) (message "%s not readable. %s" file "Do
>you have write permissi...

Read more...

Andreas Roehler (a-roehler) wrote :

Am 05.09.2013 22:22, schrieb Richard Stanton:
> Seems to work now. Thanks for fixing it so fast.
>
>

Hi Richard,

while looking for a test, see some more bug-source here.
Will do some changes next days.

If your time permits, please keep watching it, TIA,

Andreas

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

Duplicates of this bug

Other bug subscribers