[Tutor] understanding __import__()

Sean Perry shaleh at speakeasy.net
Thu Jul 27 07:13:30 CEST 2006


Kent Johnson wrote:
> The first argument to __import__ should be a module or package name, not 
> a file path, e.g. "my.settings". Python will look for the module in the 
> current sys.path the same as if you used a normal import. Apparently the 
> / is being interpreted as a . and I guess you have a file my/__init__.py so
>   import my.settings
> will work but
>   import .tmp.my.settings
> doesn't.
> 

as I mention in another email, if I do:

import sys
sys.path.insert(0, '')

It all just works. Very confused.


More information about the Tutor mailing list