__import__ returns module without it's attributes?

Dave Angel davea at ieee.org
Sat Nov 14 17:05:44 CET 2009



Zac Burns wrote:
> I've overloaded __import__ to modify modules after they are
> imported... but running dir(module) on the result only returns
> __builtins__, __doc__, __file__,
> __name__, __package__, and __path__.
>
> Why is this? More importantly, where can I hook in that would allow me
> to see the contents of the module?
>
> --
> Zachary Burns
> (407)590-4814
> Aim - Zac256FL
> Production Engineer (Digital Overlord)
> Zindagi Games
>
>   
I'm probably not the one to give you the actual answer (at least not in 
the next couple of days), but I could help you ask a better question.

Provide a simple example of your code, and what it does.  Describe the 
python version and OS platform you're running it on.  And detail the 
contents of any extra files or environment values that are needed to 
reproduce the problem.

(You may find http://www.catb.org/~esr/faqs/smart-questions.html  useful)

BTW, I don't know of any method __import__(), only a builtin function, 
so I don't see how you can overload it. But your example should make it 
clear what you really meant.

HTH
DaveA



More information about the Python-list mailing list