Newbie thwarted by sys.path on Vista

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Aug 2 04:55:04 EDT 2009


Michael M Mason wrote:
> 
> "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!
Be careful, I'm screwed things up on several occasions by placing a file 
on PYTHONPATH that overrides a file in the standard library, test.py 
being my favourite!
> 
>> 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
> 
-- 
Kindest regards.

Mark Lawrence.




More information about the Python-list mailing list