pointing to the correct python

Andy Robinson andy at reportlab.com
Thu Mar 20 22:47:10 CET 2003


On Sat, 15 Mar 2003 04:04:40 GMT, Andrew Koenig <ark at research.att.com>
wrote:

>Bob> I am running cygwin under windows.  If I have a python program that
>Bob> starts with
>Bob> #!/usr/bin/python
>Bob> it uses the cygwin python, which for most stuff is fine.  But I need
>Bob> to use the windows version of python any time I want to use PIL,
>Bob> pygame, etc..  How do I tell the environment which python to use
>Bob> (besides using #!/n/Python22/python)?
>

If you start a script with "python myscript.py" then it depends which
python is on your path.  If, as most do, you just use "myscript.py"
then it will be passed to the application associated with ".py".
You can change this from View | Options | File Types in explorer
(AFAIR) to the Python of your choice, but it's system wide.

So, why not associate .py with a little batch file which looks in
the first line for a shebang, and passes it to that Python?
Then you could basically do what you do on Unix.

Or (simpler) give you top level scripts distinctive extensions
like '.cpy' for Cygwin.

- Andy Robinson






More information about the Python-list mailing list