Comment 4 for bug 921990

Revision history for this message
yagnesh (yagnesh) wrote : Re: [Bug 921990] Re: Py-choose-shell is overriding `ipython' option with shebang

On 01/27/2012 11:26 PM, Andreas Roehler wrote:
> Hi Yagnesh,
>
> can you try the new design?
>
> Thanks,
> Andreas
>
> ** Changed in: python-mode
> Status: New => Fix Committed
>
Here are my observations:

context:
- python-mode.el from bzr trunk
    (user configured `py-shell-name' is not honored by
`py-guess-default', lp:920079, fixed)
- emacs 24 from bzr-trunk as well.
- Test python3 file called bug.el contents are the following.
-------------------------------------
#!/usr/bin/env python3
# File: bug.py

a = "b"
print(a)

# bug.py ends here
-------------------------------------

Every time I opened my emacs 24 (from latest head) like this
emacs -q -l ~/.emacs.d/minimal.el bug.py

Case 1: If I dont set py-shell-name at all.
=============================================
observation:
- as I opened the file, I see a python2 shell (comint-run)
   Buffer.
- Pressing C-c C-c takes me to that python2 shell

Remarks:
- as I open the file it, it may open a python3 shell instead of and
   python2.

Case 2: If I set to py-shell-name to "ipython"
=============================================

Observation:
- as I opened the file, I see a python2 shell (comint-run)
   Buffer.
- pressing C-c C-c taking to *Ipython* buffer with the following error
message.

,----
| In [1]:
---------------------------------------------------------------------------
| NameError Traceback (most recent call
last)
| /home/yagnesh/tmp/<ipython-input-1-b069c4a96c1a> in <module>()
| ----> 1 execfile(r'/tmp/IPython31683Bz7.py') # PYTHON-MODE
|
| NameError: name 'execfile' is not defined
`----

Remarks:
- again it should not have opened a python2 shell
- at least pressing C-c C-c should not give any error.
   since its python3 the C-c C-c should have sent exec instead execfile

Case 3: If I set to py-shell-name to "ipython3"
=============================================
Observation:
- as I opened the file, I see a python2 shell (comint-run)
   Buffer.
- pressing C-c C-c taking to *Ipython3* buffer executing execution is
fine.

Remarks:
- and again it should not have opened a python2 shell

The end for now.

Finally, I think this is first level problem user will face, if we clear
this one we can go debugging on to the next problems. apologies for
not able to submit a patch.

Thanks again
Yagnesh