wrong second ipython buffer

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

Bug Description

Am 13.03.2012 07:36, schrieb Richard Stanton:
> If I press C-c ! on my Windows machine, an ipython shell opens in a buffer called
> *c:/python27/Scripts/IPython.bat. If I remain in the python script
> buffer and now press C-c C-c, rather than sending the buffer through the
> ipython shell I just opened, it creates a second ipython buffer, called
> *IPython*, which replaces the first as the open buffer, and the python
> script is run there instead. I think this is a change from prior
> behavior, and doesn't really make sense to me - I'd rather the script
> just got run through the shell I first opened. I don't really want two
> ipython buffers.
>

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
milestone: none → 6.0.6
importance: Undecided → Medium
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 953774] [NEW] wrong second ipython buffer

Am 13.03.2012 08:17, schrieb Andreas Roehler:
> Public bug reported:
>
> Am 13.03.2012 07:36, schrieb Richard Stanton:
>> If I press C-c ! on my Windows machine, an ipython shell opens in a buffer called
>> *c:/python27/Scripts/IPython.bat. If I remain in the python script
>> buffer and now press C-c C-c, rather than sending the buffer through the
>> ipython shell I just opened, it creates a second ipython buffer, called
>> *IPython*, which replaces the first as the open buffer, and the python
>> script is run there instead. I think this is a change from prior
>> behavior, and doesn't really make sense to me - I'd rather the script
>> just got run through the shell I first opened. I don't really want two
>> ipython buffers.
>>

not so here. Send you a png.

You see the previous computation and below the output from C-c C-c

May you send me an example file, which triggers it?

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

I don't think the specific file contents matter (though I don't have your
first line, in case that matters). Here's one that exhibits the problem:

-----------

Print "Hi, Richard"

-----------

My report yesterday was about running under Windows. Today (3/13) I'm at
work running today's version of python-mode in Emacs 24.0.93 under OS X.On
this machine, my init.el contains the line

(setq py-shell-name
"/Library/Frameworks/EPD64.framework/Versions/7.2/bin/ipython")

Here's a description of a sample session:

1) Fire up Emacs and load run.py, the file above.

2) Press C-c ! to open a new python buffer. This works fine, splitting
properly, and starts python in a buffer called

  */Library/Frameworks/EPD64.framework/Versions/7.2/bin/IPython* (note the
capitalization)

3) Leaving the cursor in the run.py buffer, now press C-c C-c

PROBLEM 1: The python buffer opened in step 2 now disappears, leaving me
starting at a split window where both halves of the window contain run.py.

PROBLEM 2: run.py did get run (well, actually, I get the old error about
"no such file or directory", but it'll run if I try again), but not in the
python shell opened above. Instead, it's run in a brand new python buffer
(the old one is still there too) called

  */library/frameworks/epd64.framework/versions/7.2/bin/Ipython*

Note that the name is the same as before, but with different
capitalization.

The command run in both buffers is the same in this case (unlike on my
Windows machine yesterday):

  /Library/Frameworks/EPD64.framework/Versions/7.2/bin/ipython -i

On 3/13/12 2:14 PM, "Andreas Roehler" <email address hidden> wrote:

>Am 13.03.2012 08:17, schrieb Andreas Roehler:
>> Public bug reported:
>>
>> Am 13.03.2012 07:36, schrieb Richard Stanton:
>>> If I press C-c ! on my Windows machine, an ipython shell opens in a
>>>buffer called
>>> *c:/python27/Scripts/IPython.bat. If I remain in the python script
>>> buffer and now press C-c C-c, rather than sending the buffer through
>>>the
>>> ipython shell I just opened, it creates a second ipython buffer, called
>>> *IPython*, which replaces the first as the open buffer, and the python
>>> script is run there instead. I think this is a change from prior
>>> behavior, and doesn't really make sense to me - I'd rather the script
>>> just got run through the shell I first opened. I don't really want two
>>> ipython buffers.
>>>
>
>not so here. Send you a png.
>
>You see the previous computation and below the output from C-c C-c
>
>May you send me an example file, which triggers it?
>
>
>** Attachment added: "ipy.png"
>
>https://bugs.launchpad.net/bugs/953774/+attachment/2865850/+files/ipy.png
>
>--
>You received this bug notification because you are subscribed to the bug
>report.
>https://bugs.launchpad.net/bugs/953774
>
>Title:
> wrong second ipython buffer
>
>Status in An Emacs mode for editing Python code:
> New
>
>Bug description:
> Am 13.03.2012 07:36, schrieb Richard Stanton:
> > If I press C-c ! on my Windows machine, an ipython shell opens in a
>buffer called
> > *c:/python27/Scripts/IPython.bat. If I remain in the python script
> > buffer and now press C-c C-c, rather than sending the buff...

Read more...

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

did something around the path.
may you check again?

thanks

Changed in python-mode:
status: New → In Progress
Revision history for this message
Richard Stanton (a-stanton) wrote : RE: [Bug 953774] Re: wrong second ipython buffer
Download full text (4.5 KiB)

> did something around the path.
> may you check again?

My Mac really doesn’t like this!

I pressed C-c ! to open a new python shell, then C-c C-c to run the script, resulting in the following error message:

Debugger entered--Lisp error: (file-error "Opening output file" "No such file or directory" "/var/folders/zf/bgjm4tvs3wv_6q7_6z3b2nx00000gn/T/*/Library/Frameworks/EPD64.framework/Versions/7.2/bin/IPython*55019M_B.py")
  write-region(1 5270 "/var/folders/zf/bgjm4tvs3wv_6q7_6z3b2nx00000gn/T/*/Library/Frameworks/EPD64.framework/Versions/7.2/bin/IPython*55019M_B.py" nil t nil ask)
  (let* ((pop-up-windows py-shell-switch-buffers-on-execute-p) (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-shell-name-prepare shell sepchar)) (temp (make-temp-name name)) (file (concat (expand-file-name temp py-temp-directory) ".py")) (filebuf (get-buffer-create file)) (proc (or (get-process name) (get-process (py-shell nil dedicated (or shell (downcase shell)) switch sepchar)))) (procbuf (if dedicated (buffer-name (get-buffer (current-buffer))) (buffer-name (get-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)) (unless (get-process "*IPython*") (sit-for py-ipython-execute-delay))) (setq erg (py-execute-file-base proc file pec)) (setq py-exception-buffer (cons file (current-buffer))) (cond ((eq switch (quote switch)) (if py-split-windows-on-execute-p (progn (delete-other-windows) (funcall py-split-windows-on-execute-function)) (set-buffer regbuf)) (set-buffer procbuf) (switch-to-buffer (current-buffer)) (goto-char (point-max))) ((eq switch (quote noswitch)) (when py-split-windows-on-execute-p (delete-other-windows) (funcall py-split-windows-on-execute-function)) (set-buffer regbuf) (switch-to-buffer (current-buffer))) ((and py-shell-switch-buffers-on-execute-p py-split-windows-on-execute-p) (funcall py-split-windows-on-execute-function) (switch-to-buffer (current-buffer)) (switch-to-buffer regbuf) (pop-to-buffer procbuf)) (py-split-windows-on-execute-p (delete-other-windows) (pop-to-buffer procbuf) (set-buffer procbuf) (funcall py-split-windows-on-execute-function) (switch-to-buffer regbuf)) (py-shell-switch-buffers-on-execute-p (set-buffer procbuf) (switch-to-buffer (current-buffer)))) (unless (string= (buffer-name (current-bu...

Read more...

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

okay, should be done meanwhile with lp:955338

back to this maybe?

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

Bug attachments

Remote bug watches

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