Gabriele *Darkbard* Farina wrote:

> I have a python file inside a zip file. I'd like to compile it and add
> the resulting .pyc file into the zip. I tryed reading the source and
> compiling it using compile(), but I don't know how to write .pyc file.
> Can someone give me some help?

a PYC file consists of a 4-byte header (from imp.get_magic()), an 4-byte
timestamp (seconds since epoch as a 32-bit little endian integer), followed
by the marshalled code block.

see the source code for the py_compile module in the standard library for
some sample code -- or use the module itself to do the work for you:

    http://effbot.org/librarybook/py-compile.htm

</F> 



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

Reply via email to