python-mode and py-python-command

Siggy Brentrup bsb at winnegan.de
Wed Jul 4 19:21:34 EDT 2001


Roman Suzi <rnd at onego.ru> writes:

> Hello!
> 
> How do I tell Emacs to call specific Python interpreter
> within a certain file with Python code?
> 
> I know that for this I need to set up py-python-command
> variable, but how to do it?

Which version of py-mode.el are you using (C-h v py-version)?
On my system it shows 

  Value: "3.105"

That version is slightly broken, it runs the Python interpreter
in the py-which-shell buffer-local variable. This variable is set from
py-python-command on M-1 C-c C-t (py-toggle-shells).

[...]

> 3. What is wrong with this (at the end of file)?
> 
> % Local Variables:
> % mode: python
> % py-python-command: \"/usr/bin/python2.1\"
> % End:

Python will choke on % as a comment character.

The following snippet shows how to set the variables including a
workaround for the buglet.

--------- snip --------
import sys
print sys.version[:3]

# Local variables:
# py-python-command: "python2.1"
# py-which-shell: "python1.5"
# End:
--------- snip --------

HTH
  Siggy

-- 
Siggy Brentrup - bsb at winnegan.de - http://www.winnegan.de/
****** ceterum censeo javascriptum esse restrictam *******




More information about the Python-list mailing list