Not Sure This Can Be Done...
Diez B. Roggisch
deets at nospam.web.de
Tue Apr 1 17:05:22 EDT 2008
gamename schrieb:
> Hi,
>
> I generally have several copies of the same development environment
> checked out from cvs at any one time. Each development tree has a
> 'tools' dir containing python modules. Scattered in different places
> in the tree are various python scripts.
>
> What I want to do is force my scripts to always look in the closest
> 'tools' dir for any custom modules to import. For example:
>
> tree1/tools
> tree1/my_scripts/foo.py
>
> tree2/tools
> tree2/my_scripts/foo.py
>
> How can I make 'foo.py' always look in '../../tools' for custom
> modules? My preference would be to avoid changing the 'foo.py' script
> and have some way to resolve it via the environment (like PYTHONPATH,
> or .pth files, etc.).
>
> Anyone have any ideas?
Use virtualenv to create a local python, and activate that when
developing for that branch.
Alternatively, you can of course manipulate the PYTHONPATH yourself -
but why should you if virtualenv takes care of that for you?
Diez
More information about the Python-list
mailing list