Newbie thwarted by sys.path on Vista

David Lyon david.lyon at preisshare.net
Sun Aug 2 02:26:19 CEST 2009


On Sat, 1 Aug 2009 22:58:53 +0100, "Michael M Mason"
<michael at altra-optics.co.uk> wrote:
> I'm running Python 3.1 on Vista and I can't figure out how to add my own 
> directory to  sys.path.
> 
> The docs suggest that I can either add it to the PYTHONPATH environment 
> variable or to the PythonPath key in the registry.  However, PYTHONPATH 
> doesn't exist, and updating the registry key has no effect
>
> So where does sys.path get its value from, and how do I change it?

The simplest hack (worst - but most direct) is that sys.path is a list
and you can use it like any other list. (add, delete, change items in it)

It gets loaded from site.py (in the standardard library) at startup.

Anything else you'll have to ask somebody else.

David



More information about the Python-list mailing list