If passed a .py file as an argument, try to find its accompanying
.pyc.
#! /usr/bin/env python
import marshal
+import os
import dis
import types
def dump(obj):
print obj
for attr in dir(obj):
- print "\t", attr, repr(getattr(obj, attr))
+ if attr.startswith('co_'):
+ val = getattr(obj, attr)
+ print "\t", attr, repr(val)
def loadCode(path):
f = open(path)
else:
filename = sys.argv[1]
codename = None
+ if filename.endswith('.py') and os.path.exists(filename+"c"):
+ filename += "c"
main(filename, codename)