Last active
December 14, 2015 11:49
-
-
Save benmezger/5081940 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
# Randoms.py: | |
import random | |
import hahaha | |
import hihihi | |
print "Hello, this is the end of the file" | |
# check_module.py | |
In [1]: from modulefinder import ModuleFinder | |
In [2]: finder = ModuleFinder() | |
In [3]: finder.run_script('Randoms.py') | |
In [4]: print '\n'.join(finder.badmodules.iterkeys()) | |
riscospath | |
os2 | |
_sha512 | |
riscos | |
_emx_link | |
_subprocess | |
ce | |
_md5 | |
_sha256 | |
_sha | |
hihihi | |
org.python.core | |
hahaha | |
riscosenviron | |
nt | |
msvcrt | |
os.path | |
# Note you can also use finder.any_missing, according to help(finder.any_missing) | |
In [11]: finder.any_missing ? | |
Type: instancemethod | |
String Form:<bound method ModuleFinder.any_missing of <modulefinder.ModuleFinder instance at 0x20a09e0>> | |
File: /usr/lib/python2.7/modulefinder.py | |
Definition: finder.any_missing(self) | |
Docstring: | |
Return a list of modules that appear to be missing. Use | |
any_missing_maybe() if you want to know which modules are | |
certain to be missing, and which *may* be missing. | |
In [12]: finder.any_missing() | |
Out[12]: | |
['_emx_link', | |
'_md5', | |
'_sha', | |
'_sha256', | |
'_sha512', | |
'_subprocess', | |
'ce', | |
'hahaha', | |
'hihihi', | |
'msvcrt', | |
'nt', | |
'org.python.core', | |
'os.path', | |
'os2', | |
'riscos', | |
'riscosenviron', | |
'riscospath'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment