[Tutor] Setting PYTHONPATH and other env vars dynamically

Kent Johnson kent37 at tds.net
Wed Aug 19 13:53:16 CEST 2009


On Tue, Aug 18, 2009 at 7:57 PM, Jramak<jramak345 at gmail.com> wrote:
> Hello
> We have developed three custom applications in Python. Each one of
> these applications needs a different PYTHONPATH, in addition to
> different environment variables to work. Instead of manually setting
> the environment variables for each application, what would be the best
> way to set PYTHONPATH and other environment variables for a specific
> application? We only run one application at a time, not all of them.
> We are running Python 2.5.2 and Python 2.4.1 on Win2K. Is a bash
> script that sets the environment variables on the application start-up
>  way to go?
>
> Any ideas? I was not aware of site.py until a co-worker bandied it
> about - he says site.py is better than PYTHONPATH.

Don't edit site.py, it is part of the std lib. If you do want to
customize it, add a site-customize.py in your site-packages folder and
put your customizations there.

Kent


More information about the Tutor mailing list