Newbie thwarted by sys.path on Vista

Jon Clements joncle at
Sun Aug 2 01:32:21 CEST 2009

On 1 Aug, 22:58, "Michael M Mason" <mich... at> 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 (and in any case
> the contents aren't the same as sys.path).
> So where does sys.path get its value from, and how do I change it?
> --
> Michael

sys.path is just a list. So in your 'main' module where you do most of
your imports, just append or prepend the path you desire (the search
order is left to right). Although, I believe under Windows creating a
system level or user level PYTHONPATH environment variable will enable
Windows to pick it up. Not 100% sure as I don't have a Windows machine

More information about the Python-list mailing list