Question about details of __import__
Mitko Haralanov
mitko at qlogic.com
Thu Mar 29 18:09:33 EDT 2007
On Thu, 29 Mar 2007 16:45:08 -0300
"Gabriel Genellina" <gagsl-py2 at yahoo.com.ar> wrote:
> If you think that Python got confused and has two duplicate modules, try
> to find them in sys.modules. Perhaps under the names 'log' and 'xxx.log'
> Or, using print, try to see *when* your global variable is reset to None.
OK, I figured it out: it turns out that for some reason, the global
namespace did not contain the log module, so when the modules imported
with __import__ got processed, their log module got a new namespace (at
least, that's what I think is happening).
Once the log module became a top level module in sys.modules,
everything worked.
--
Mitko Haralanov mitko at qlogic.com
Senior Software Engineer 650.934.8064
System Interconnect Group http://www.qlogic.com
==========================================
If computers take over (which seems to be their natural tendency), it
will serve us right.
-- Alistair Cooke
More information about the Python-list
mailing list