Created
July 2, 2015 14:15
-
-
Save cstrap/13b443e7178c6521028c to your computer and use it in GitHub Desktop.
Print order imports by rewriting builtin __import__ in order to see circular references.
Put this on e.g. manage.py.
From [email protected] S.Federici
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import __builtin__ | |
| original_import = __builtin__.__import__ | |
| def log_import(name, globals={}, locals={}, fromlist=[], level=-1): | |
| print name | |
| return original_import(name, globals=globals, locals=locals, fromlist=fromlist, level=level) | |
| __builtin__.__import__ = log_import |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment