Created
June 21, 2014 17:26
-
-
Save hidenorigoto/ea5292d2dc01384eae42 to your computer and use it in GitHub Desktop.
ロードされているモジュールリスト
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -* | |
# from http://tell-k.hatenablog.com/entry/2012/02/04/131805 | |
from pydoc import ModuleScanner | |
from string import find | |
modules = [] | |
def callback(path, modname, desc, modules=modules): | |
if modname and modname[-9:] == '.__init__': | |
modname = modname[:-9] | |
if modname not in modules: | |
modules.append(modname) | |
def onerror(modname): | |
callback(None, modname, None) | |
ModuleScanner().run(callback, onerror=onerror) | |
print modules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment