doted filenames in import statements

Jean-Michel Pichavant jeanmichel at sequans.com
Tue Jul 21 17:42:41 EDT 2009


Hi fellows,

I'd like to use the dynamic __import__ statement. It works pretty well 
with non dotted names, but I cannot figure how to make it work with 
dotted file paths.

example:

file = "/home/dsp/test.py"
test = __import__(file)

works like a charm

file = "/home/dsp/4.6.0.0/test.py"
test = __import__(file)
=> no module name blalalal found.

Any suggestion ? I tried multiple escape technics without any success.

JM




More information about the Python-list mailing list