"Derek van Vliet" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Using the Python/C API, is there a way I can import a pyc file that I
> have in memory (as opposed to loading from disk)?
>
> I'm trying to save compiled python code in a proprietary file format to
> cut reduce the overhead of compiling all my scripts when my app starts
> up.


you can use a zip file as "proprietary file format"? with .pyc's or .py's in
and add the zippath to sys.path ?

other than that you can load the code object of .pyc's content in a string
like

co = marshal.loads( pyc_s[8:] )
mod=imp.new_module('xy')
exec co in mod.__dict__


Robert


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to