Michael M Mason wrote:

"Dave Angel" <da...@ieee.org> wrote in message news:mailman.4120.1249172970.8015.python-l...@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.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to