[Tutor] Trouble with sys.path.append

Lie Ryan lie.1296 at gmail.com
Sun Aug 8 10:46:24 CEST 2010

aug dawg <augdawg09 <at> gmail.com> writes:
> Earlier today, I tried to add a folder to my PYTHONPATH. When 
> I tried sys.path.app('location/of/folder'), the command successfully
> executed it, but then when I did sys.path to check to see if it was
> now in my PYTHONPATH, it was not there. Does anyone know what might
> be causing this?

Appending to sys.path will only change the module search directory for the
current *python* session. 

If you want to add a directory to the current *terminal* session, then export
PYTHONPATH environment variable into your shell.

If you want to *permanently* add a directory to the module search directory, add
a .pth file to a directory that is already inside a search path (typically in
<python-install-dir>/site-packages). Alternatively, modify the site.py file. See
here for details: http://docs.python.org/install/#inst-search-path

More information about the Tutor mailing list