[Distutils] pkg_resources on Windows

Michael Foord fuzzyman at gmail.com
Tue Dec 13 14:08:23 CET 2011

On 13 December 2011 11:40, Andrea Crotti <andrea.crotti.0 at gmail.com> 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"

All the best,

Michael Foord

- some other weird bug
> Is there a way to solve this thing?
> ______________________________**_________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/**mailman/listinfo/distutils-sig<http://mail.python.org/mailman/listinfo/distutils-sig>



May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20111213/5f571fd5/attachment.html>

More information about the Distutils-SIG mailing list