En Thu, 21 Jun 2007 17:03:42 -0300, David Abrahams  
<[EMAIL PROTECTED]> escribió:

> Another example: I was recently working on some code that did an
> import from inside a class method.  That import was failing.  I moved
> the import to the top of the file (at module scope) and it succeeded.
> I'm fairly sure that nobody was monkeying around with sys.path in that
> case.  Can anyone think of a likely explanation?

The imported module and the main script both reside on the same directory,  
and it is executed from there. sys.path contains '' in this case (not the  
full path). The script changes the current directory (os.chdir) after  
doing other imports and initialization. From now on, importing a module  
 from the original directory doesn't work anymore.

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to