Newbie thwarted by sys.path on Vista

Michael M Mason michael at altra-optics.co.uk
Sun Aug 2 08:34:56 CEST 2009


"Dave Angel" <davea at ieee.org> wrote in message 
news:mailman.4120.1249172970.8015.python-list at python.org...
> Michael M Mason wrote:
>> <div class="moz-text-flowed" style="font-family: -moz-fixed">I'm running 
>> Python 3.1 on Vista and I can't figure out how to add my own directory to 
>> sys.path.

Thanks to Jon, Piet, David and Dave for the responses.

> sys.path gets its values from several places.

Ah, I'd misunderstood the docs: I thought it came from just one place (which 
I couldn't find).

> Anyway, I'd suggest adding it to PythonPath, and if it's empty, just 
> create it with the directory you need.

Thanks--that worked!

> I'm hoping you know you can also add to sys.path directly during script 
> initialization.  It's just a list, and is writeable.

Yes, but I'm mainly playing in IDLE and I was getting a bit fed up of 
repeatedly typing
  import sys
  sys.path.append('C:/Users/Michael/Code/Python')
  import mystuff

-- 
Michael





More information about the Python-list mailing list