Import module

Gordon McMillan gmcm at hypernet.com
Tue May 25 09:59:39 EDT 1999


Anton writes:
 
> I have one (but big) problem. I can't load (import)
> compiled module from other sources than file. I want import
> module (.PYC) from string, socket or other object but not
> only from file. How I can do it? Who can help me?

Seems like a job for Greg Stein's imputil.py:
 http://www.lyra.org/greg/small/

Or you can at least steal the code that skips over the header and 
unmarshalls the code object.

- Gordon




More information about the Python-list mailing list