how to change sys.path?

Ziga Seilnacht ziga.seilnacht at
Thu May 25 15:29:33 CEST 2006

Michael Yanowitz wrote:
> Is there something like a .pythoninitrc which can run whenever we start
> Python
> that can load a file with many sys.path.append(), etc?
>   If not is there some way to modify the Python shell constructor and
> destructor?
> Thanks in advance:
> Michael yanowitz

Yes, there is the user module:
which you have to explicitly import and which will look for file in user's home directory and execute it.

The other option is a sitecustomize module, which should
be put somewhere on the initial search path. It will be
imported automatically during the interpreter initialization.
for details.


More information about the Python-list mailing list