module import search path strangeness

Peter Otten __peter__ at web.de
Tue Aug 12 13:54:42 EDT 2008


Sion Arrowsmith wrote:

> Peter Otten  <__peter__ at web.de> wrote:
>>tow wrote:
>>>     sys.path.append(os.path.join(project_directory, os.pardir))
>>>     project_module = __import__(project_name, {}, {}, [''])
>>>     sys.path.pop()
>>Ouch.
> 
> I presume that "Ouch" is in consideration of what might happen if
> the subject of the __import__ also calls sys.path.append ...?
 
Yes ;)

Peter



More information about the Python-list mailing list