site.py confusion

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jan 29 15:18:42 EST 2010


En Wed, 27 Jan 2010 15:48:23 -0300, George Trojan <george.trojan at noaa.gov>  
escribió:
> Arnaud Delobelle wrote:
>> George Trojan <george.trojan at noaa.gov> writes:
>>
>>> Inspired by the 'Default path for files' thread I tried to use
>>> sitecustomize in my code. What puzzles me is that the site.py's main()
>>> is not executed. My sitecustomize.py is
>
> That gave me the explanation why the above happens: when site is  
> imported, the current directory is not yet prepended to sys.path.
>
> I wanted to have library location specific to application without having  
> to explicitly change sys.path in all App-Top-Dir/bin/*.py. I thought  
> creating bin/sitecustomize.py would do the trick.

Put sitecustomize.py in any of those directories already in sys.path; on  
Python 2.6, you may put sitecustomize.py on your "user site directory",  
~/.local/lib/python2.6/site-packages (see PEP370; it won't show up in  
sys.path unless the directory actually exists)

-- 
Gabriel Genellina




More information about the Python-list mailing list