views:

47

answers:

1

I have a .pyc file with no corresponding Python source code. I want to see the disassembly of the module using dis. I can import my module just fine with

import dis
import foo

But to call dis.dis on it, I can't use the module object. I need the corresponding code object which backs foo. How do I create it? It seems that the compile builtin can compile strings, classes, methods, and functions, but not files or modules.

How do I generate this code object given what I have?