On 3/16/12 11:14 PM, Andrea Crotti wrote:
Very nice thanks, here it is
class ImportMock:
def _my_import(self, *args, **kwargs):
self.ls.append(args[0])
self.orig(*args, **kwargs)
There's a bug here. You need to return the module object you got from calling
self.orig(). By
On 03/16/2012 10:20 PM, Robert Kern wrote:
On 3/16/12 10:04 PM, Andrea Crotti wrote:
On 03/16/2012 05:19 PM, Robert Kern wrote:
On 3/16/12 4:49 PM, Andrea Crotti wrote:
I started the following small project:
https://github.com/AndreaCrotti/import-tree
because I would like to find out what ex
On 3/16/12 10:04 PM, Andrea Crotti wrote:
On 03/16/2012 05:19 PM, Robert Kern wrote:
On 3/16/12 4:49 PM, Andrea Crotti wrote:
I started the following small project:
https://github.com/AndreaCrotti/import-tree
because I would like to find out what exactly depends on what at run-time, using
an
On Fri, Mar 16, 2012 at 4:04 PM, Andrea Crotti
wrote:
>> You want to monkeypatch __builtin__.__import__() instead. It always gets
>> called.
>>
>
> Seems like a good idea :)
>
> My first attempt failes though
>
>
> def full(module):
> from __builtin__ import __import__
> ls = []
> orig =
On 03/16/2012 05:19 PM, Robert Kern wrote:
On 3/16/12 4:49 PM, Andrea Crotti wrote:
I started the following small project:
https://github.com/AndreaCrotti/import-tree
because I would like to find out what exactly depends on what at
run-time, using
an import hook.
It works quite well for sma
On 3/16/12 4:49 PM, Andrea Crotti wrote:
I started the following small project:
https://github.com/AndreaCrotti/import-tree
because I would like to find out what exactly depends on what at run-time, using
an import hook.
It works quite well for small examples but the main problem is that once
Andrea Crotti wrote:
I started the following small project:
https://github.com/AndreaCrotti/import-tree
because I would like to find out what exactly depends on what at
run-time, using an import hook.
It works quite well for small examples but the main problem is that once
a module is impor
I started the following small project:
https://github.com/AndreaCrotti/import-tree
because I would like to find out what exactly depends on what at
run-time, using an import hook.
It works quite well for small examples but the main problem is that once
a module is imported
it's added to sys.