Python path on windows

Dave Angel davea at davea.name
Sat Feb 21 09:10:30 EST 2015


On 02/21/2015 06:05 AM, Gisle Vanem wrote:
> Dave Angel wrote:
>
>> Finally, when py.exe starts, it reads that first (shebang) line, and
>> decides which python interpreter to actually use.
>
> py.exe? Do you mean python.exe?

Reread my post, or read Mark's reply to yours.  The job of py.exe or 
pyw.exe is to examine the shebang line and then exec the appropriate 
python.exe

>
> Is there a way to make python.exe ignore all Shebang lines
> in all scripts? I had many generated .py-files with:
>    #!g:\ProgramFiler\Python27\python.EXE

That's what symlinks are for, on Unix-like systems.  Somewhere I read 
that Windows has had them for a little while now.  Those generated files 
should have pointed to a symlink on your system drive, rather than 
pointing directly to drive G:

But you could always write your own py.exe, which interprets the shebang 
differently.

Or run python.exe yourself, which as far as I know, pays no attention to 
shebang lines.

>
> After transferring my Python tree to a new Win-8.1 PC, my Python
> tree was installed under "f:\ProgramFiler\" and my CD-ROM on "g:\"
>
> This caused those scripts to access my CD-ROM or pop-up a Win-GUI
> error dialogue if no CD-ROM was in the drive. Irritating.
>
>


-- 
DaveA



More information about the Python-list mailing list