PY2EXE => Is there a way to go backwards? EXE2PY

Peter Hansen peter at engcorp.com
Wed Jul 13 18:07:38 EDT 2005


Joe wrote:
> I have the executable of a script that I wrote, that has been erased.
> Is there any way to retrieve the uncompiled python script from the
> executable that was created with py2exe?

The .pyc files are in a file called library.zip, and they're pretty easy 
to extract.

To convert .pyc files to .py files, look for "decompyle", which might be 
up-to-date these days, but is probably still available only as a for-pay 
online service.  Note that it cannot produce a file identical to your 
source, but it can come pretty close, certainly close enough to save 
your hide and tide you over until you can learn to use a source code 
control system (I highly recommend Subversion as both free and 
effective). ;-)

-Peter



More information about the Python-list mailing list