Shebang question under Windows

Asked by Richard Stanton

Running r993 under Windows, with the following line in init.el,

  (setq py-shell-name "c:/python27/Scripts/ipython.bat")

if I open the following file:

-----------

#!/usr/bin/ipython
print "Hi, Richard"

----------

it opens fine, and an ipython buffer called *ND c:/Python27/Scripts/ipython.bat* is also created.

If I now press C-c C-c to execute the file, however, I get the error message:

Spawning child process: invalid argument

At a guess, maybe it's taking the shebang line seriously, and trying to open /usr/bin/ipython, which doesn't exist in my setup. But if that's the case,

i. Can we over-ride the shebang line (as python-mode used to do) to prevent this problem under Windows?

ii. Why does it open the other ipython buffer and then not use it?

Thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andreas Roehler (a-roehler) said :
#1

Am 28.05.2012 22:40, schrieb Richard Stanton:
> New question #198704 on python-mode.el:

Calling py-execute-buffer with universal argument C-u will enforce the use of

shell indicated in py-shell-name - instead of shebang.

>
> ii. Why does it open the other ipython buffer and then not use it?

py-execute-buffer needs a running process. As creating a new Python-shell buffer may cause delay,
making sure some exists is done at an early time in code.

Revision history for this message
Richard Stanton (a-stanton) said :
#2

> Andreas Roehler proposed the following answer:
> Am 28.05.2012 22:40, schrieb Richard Stanton:
> > New question #198704 on python-mode.el:
>
> Calling py-execute-buffer with universal argument C-u will enforce the use of
>
> shell indicated in py-shell-name - instead of shebang.

Is there a simple way to make this the default behavior?

Revision history for this message
Andreas Roehler (a-roehler) said :
#3

Am 29.05.2012 07:45, schrieb Richard Stanton:
> Question #198704 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/198704
>
> Status: Answered => Open
>
> Richard Stanton is still having a problem:
>> Andreas Roehler proposed the following answer:
>> Am 28.05.2012 22:40, schrieb Richard Stanton:
>>> New question #198704 on python-mode.el:
>>
>> Calling py-execute-buffer with universal argument C-u will enforce the use of
>>
>> shell indicated in py-shell-name - instead of shebang.
>
> Is there a simple way to make this the default behavior?
>

customize py-force-py-shell-name-p

Can you help with this problem?

Provide an answer of your own, or ask Richard Stanton for more information if necessary.

To post a message you must log in.