Runtime load python modules from memory

S

scream.ru

Hello!

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?
 
G

Gabriel Genellina

En Thu, 10 Dec 2009 12:13:15 -0300, (e-mail address removed)
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,517
Latest member
Andres38A1

Latest Threads

Top