How would I generate a .pyc file from a Python AST such that I could import the file from Python?
I've used compile
to create a code object, then written the co_code
attribute to a file, but when I try to import the file from Python, I get an ImportError: Bad magic number in output.pyc
.