PYTHONPATH or any other way to set seachpath (winXP) ?

Ron Adam rrr at ronadam.com
Sun Feb 4 15:10:35 EST 2007


Stef Mientki wrote:
>> Do you mean something like that?
>>
>>>>> import some_module
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>> ImportError: No module named some_module
>>>>> import sys
>>>>> sys.path.append("..")
>>>>> import some_module
> Rob,
> thank you very much,
> that's exactly what I want.
> (Why is the obvious so often invisible to me ;-)
> 
> cheers,
> Stef Mientki

Just a note, If you run the module from different location, it may not always 
work.

The '..' is relative to the location you are running the module from, the 
current directory, and not relative to the location of the module is at.

It won't be a problem for you if you can be sure the module is always ran from 
the location it is at.

Cheers,
Ron




More information about the Python-list mailing list