On 12/13/2011 01:08 PM, Michael Foord wrote:


On 13 December 2011 11:40, Andrea Crotti <[email protected] <mailto:[email protected]>> wrote:

    I have a script installed with "python setup.py develop" on
    windows 7 in
    the directory c:\python25\scripts.

    The script looks like:

    #!c:\python25\python.exe
    # EASY-INSTALL-DEV-SCRIPT: 'psi.devsonly==0.1','dev_main.py'
    __requires__ = 'psi.devsonly==0.1'
    from pkg_resources import require; require('psi.devsonly==0.1')
    del require
    __file__ = 'h:\\long\\path\\bin\\dev_main.py'
    execfile(__file__)

    c:\python25\script is actually in the $PATH, but if I try to launch
    that command it doesn't work because it tries with c:\Python27.

    long\path\git_projs\Psi>dev_main.py -h
    dev_main.py -h
    Traceback (most recent call last):
     File "C:\python25\scripts\dev_main.py", line 4, in <module>
       from pkg_resources import require; require('psi.devsonly==0.1')
     File
    
"C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py",
    line 2603, in <module>
     File
    
"C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py",
    line 666, in require
     File
    
"C:\Python27\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py",
    line 565, in resolve
    pkg_resources.DistributionNotFound: psi.devsonly==0.1


    This makes me thing that
    - the shebang is absolutely ignored



Yes, Windows ignores shebang lines, they're a UNIX convention. Windows uses file associations to decide what program to launch scripts with.

The Windows Python installer associates .py files with python.exe - so the most recent version of Python you installed will have the file association.

For scripts on Windows I *thought* setuptools created .exe wrappers to get round this problem. It may not do this when you use "setup.py develop" though.

All the best,

Michael Foord


I thought so, but I was surprised to see the shebang line in the script file, so I supposed that it was actually working. So if I just make sure that every py file is associated with that particular version of python everything should work,
right?
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to