Doesn't seem to work with python3

Bug #1305039 reported by Dasika Shishir
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Committed
Medium
Andreas Roehler

Bug Description

Although I changed the variable py-shell-name to 'python3', python2 only seem to load again and again. I'm using emacs-24.3 on f20.

Tags: python3
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1305039] [NEW] Doesn't seem to work with python3

Am 09.04.2014 14:33, schrieb Dasika Shishir:
> Public bug reported:
>
> Although I changed the variable py-shell-name to 'python3', python2 only
> seem to load again and again. I'm using emacs-24.3 on f20.

Can't reproduce, but see behavior is not that well documented as it should be.
Asume a shebang in buffer comes between.
Herewith a sum-up:

#########

Selecting a Python shell

Customize default Python shell as `py-shell-name'

`py-shell-name' might be an installed executable as
shell command `type' would display, but also a
PATH/TO/(I)PYTHON, of a virtualenv for example

You might run code by another (I)Python-version than default.

Normally this would happen if a shebang in buffer specifies it.
Shebang precedes default py-shell-name.

In case you will run code by default-shell, ignoring shebang, set
`py-force-py-shell-name-p' to. This might be done also via menu
Python/.../Switches

Another way to enforce a different shell than default is using
commands which end in version like `py-execute-statement-python3'
See menu Python/Interpreter/Other/Ignoring Defaults

########

Does this solves it for you?
If not, please describe exectly which command was used in which circumstances.
Also some example code might help.

Andreas

Changed in python-mode:
importance: Undecided → Medium
assignee: nobody → Andreas Roehler (a-roehler)
Revision history for this message
Dasika Shishir (shishirdasika) wrote :

Inside the emacs, I gave the following commands-
1. customize-variable
2. at the prompt - py-shell-name
3. changed it to python3
4. finally saved it.

But this too doesn't work. Whenever I give M-x run-python, python-2.7 pops up.
I don't have any shebangs in my script.

when I give the command 'py-execute-statement-python3', python3 comes, but as soon as
I try to run the whole buffer using C-c-c, python2.7 comes back.

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1305039] Re: Doesn't seem to work with python3

Am 11.04.2014 13:47, schrieb Dasika Shishir:
> Inside the emacs, I gave the following commands-
> 1. customize-variable
> 2. at the prompt - py-shell-name
> 3. changed it to python3
> 4. finally saved it.
>
> But this too doesn't work. Whenever I give M-x run-python, python-2.7 pops up.

Seems it starts a command of python.el

If py-shell-name is customized as python3

M-x py-shell RET should bring it up

likewise
M-x python RET
or
M-x python3 RET

The latter should work independently from customization,
allowing different interactive shells in parallel

> I don't have any shebangs in my script.
>
> when I give the command 'py-execute-statement-python3', python3 comes, but as soon as
> I try to run the whole buffer using C-c-c, python2.7 comes back.
>

Can't reproduce.
Might be a bug fixed already.
Are you able to checkout current trunk and try again?

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

Closing this a docu bug

Changed in python-mode:
status: New → Fix Committed
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.