Re: Introspect imports from module

2012-06-21 Thread Bastian Ballmann
Hi, that's really great stuff! I love it! Thx :) Am Thu, 21 Jun 2012 13:00:36 +0200 schrieb Christian Heimes : > Am 21.06.2012 10:03, schrieb Bastian Ballmann: > > Any suggestions how I could just get the import of > > module.to.inspect? Thanks && have a nice day! > > You could try a completel

Re: Introspect imports from module

2012-06-21 Thread Christian Heimes
Am 21.06.2012 10:03, schrieb Bastian Ballmann: > Any suggestions how I could just get the import of module.to.inspect? > Thanks && have a nice day! You could try a completely different approach and use the compiler package to inspect the abstract syntrax tree of a compiled module. The approach has

Introspect imports from module

2012-06-21 Thread Bastian Ballmann
Hi all, I am trying to write a function that returns a list of imports a given module is doing. The "problem" is I dont want to get the imports of the imports, but that's the case with my current solution. import __builtin__ old_import = __builtin__.__import__ def import_hook(name, globals=None,