Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37999

Re: Python launcher (PEP 397) and emacs python-mode.el

From Thomas Heller <theller@ctypes.org>
Newsgroups comp.lang.python
Subject Re: Python launcher (PEP 397) and emacs python-mode.el
Date 2013-01-31 17:35 +0100
Message-ID <amvkqcF71apU1@mid.individual.net> (permalink)
References <amuqb5FueeU1@mid.individual.net> <mailman.1246.1359630370.2939.python-list@python.org>

Show all headers | View raw


Am 31.01.2013 12:05, schrieb Andreas Röhler:
> Am 31.01.2013 10:03, schrieb Thomas Heller:
>> Has someone managed to patch python-mode.el to use
>> the PEP 397 python launcher when you hit C-c C-c?
>>
>> It seems that emacs should parse the shebang line in the edited
>> python script and pass the corresponding arguments to py.exe.
>>
>
> Yes, that's the way python-mode.el acts by default.
>
> AFAIU that launcher is implemented in Python3.3 and should not need any
> patch at all.
> Should it not work, please file a bug-report at
>
> https://bugs.launchpad.net/python-mode

Well, let me make these remarks:

1. I'm on Windows, using gnu-emacs 24.2.1, and python-mode.el 6.1.0.
I do not understand how the shebang line is used by python-mode.el,
depending on what I write into it either 'python.exe' is started when
I hit C-c C-c, or I get 'Spawning child process: invalid argument'.
The latter occurs most often when the shebang string contains 'jython'.


2. I would like to use the PEP 397 python launcher to start the python
version that is specified in the shebang line.
The python launcher py.exe parses this line when I run 'py script.py',
and then starts the corresponding python interpreter version.
The launcher parses the shebang line by its own rules (see pep397 for
exact details).  One example is this:

<script>
#!/usr/bin/python3.1-32
import sys; print(sys.version)
</script>

The python launcher starts 'c:\Python31\python.exe -3.1-32 script.py'.

I would like emacs to do the same; however this would require emacs
to do the same shebang line parsing as the launcher does.

Thomas

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python launcher (PEP 397) and emacs python-mode.el Thomas Heller <theller@ctypes.org> - 2013-01-31 10:03 +0100
  Re: Python launcher (PEP 397) and emacs python-mode.el Andreas Röhler <andreas.roehler@online.de> - 2013-01-31 12:05 +0100
    Re: Python launcher (PEP 397) and emacs python-mode.el Thomas Heller <theller@ctypes.org> - 2013-01-31 17:35 +0100
      Re: Python launcher (PEP 397) and emacs python-mode.el Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2013-01-31 18:26 +0000
        Re: Python launcher (PEP 397) and emacs python-mode.el Thomas Heller <theller@ctypes.org> - 2013-01-31 21:53 +0100
          Re: Python launcher (PEP 397) and emacs python-mode.el Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2013-01-31 23:59 +0000
          Re: Python launcher (PEP 397) and emacs python-mode.el Andreas Röhler <andreas.roehler@online.de> - 2013-02-01 08:13 +0100
      Re: Python launcher (PEP 397) and emacs python-mode.el Andreas Röhler <andreas.roehler@online.de> - 2013-01-31 19:40 +0100

csiph-web