building string for __import__()

Adrian Eyre a.eyre at optichrome.com
Tue Dec 14 05:18:22 EST 1999


> ImportError: No module named /mnt/somewhere0/foo1/flub2/TARGET

Assuming PYTHONPATH contains /mnt

import and __import__ take the format: somewhere0.foo1.flub2.TARGET

Although if you want to execute a script, you can use:

execfile("/mnt/somewhere0/foo1/flub2/TARGET")

--------------------------------------------
Adrian Eyre <mailto:a.eyre at optichrome.com>
Optichrome Computer Solutions Ltd
Maybury Road, Woking, Surrey, GU21 5HX, UK
Tel: +44 1483 740 233  Fax: +44 1483 760 644
http://www.optichrome.com 
--------------------------------------------





More information about the Python-list mailing list