how can I import a module without using pythonpath?
Phd
pyjunk at shaw.ca
Tue Dec 14 01:18:36 EST 2004
Nice, thanks so much!
Doug Holton wrote:
> Phd wrote:
>
>> Hi,
>>
>> I'm using python 2.2, I want to import a module by referring to its
>> relative location. The reason for this is that there is another module
>> with the same name that's already in pythonpath( not my decision, but
>> I got to work around it, bummer). So is there any easy way to do it?
>
>
> import sys, os
> sys.path.insert(0,os.path.abspath("relative path"))
> import module
> sys.path.remove(os.path.abspath("relative path"))
More information about the Python-list
mailing list