PYTHONPATH: dev and prod

jacopo jacopo.pecci at gmail.com
Tue Jun 11 12:28:15 EDT 2013


I am developing my code in the path:
/py/myscripts
/py/mylib
In order to "import mylib", I need to add /py/mylib to PYTHONPATH.

Now I want to save a snapshot of the current code in the production directory, I will copy all in:
/prod/myscripts 
/prod/mylib 

The problem now is that when I execute /prod/myscripts/any_script.py, every "import" will look at PYTHONPATH and therefore it will load the modules from /py/mylib. On the contrary I want to load it from /prod/mylib.

Is there an elegant way to cope with this?

thanks, Jacopo



More information about the Python-list mailing list