[Tutor] Adding to python path

Guillermo Fernandez guillermo.fernandez at epfl.ch
Sat Feb 28 11:34:29 EST 2004


Thanks for the answer, works great! :-)

Isn't there any way off adding that code (sys.path.append('../lib')) only one, 
outside the scripts, for example in an __init__.py file in the scripts directory?

Thanks,

Guille

Magnus Lycka wrote:
>>How could the scripts in the scripts/ folder use the modules of the lib/ folder 
>>if they must be called as normal programs?
> 
> 
> import sys
> sys.path.append('../lib')
> 
> ..methinks. Another option is to place the lib code in the
> standard site-packages directory.
>  
> 
>>Structure of my program:
>>bego.py
>>lib/
>>     begohandler.py
>>     mac.py
>>     ...
>>     syslogdb.py
>>scripts/
>>     matlab.py
>>     ...
>>     arrow.py
> 
> 
> 




More information about the Tutor mailing list