Runtime load python modules from memory

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Dec 10 22:41:30 EST 2009


En Thu, 10 Dec 2009 12:13:15 -0300, scream.ru at gmail.com  
<scream.ru at gmail.com> escribió:

> Is it possible to load python module from memory?
>
> For example, I can read python .pyc file into memory,
> preprocess it ( decrypt :-) ), and then import it.
>
> Is it possible?

Sure. Frozen modules are exactly that; see Tools/freeze in the source tree.
If you want to do some preprocessing, read PEP 302 and implement the  
importer protocol.

-- 
Gabriel Genellina




More information about the Python-list mailing list