How to decompile an exe file compiled by py2exe?

Peter peter at commonlawgov.org
Sat Sep 24 11:39:59 EDT 2005


Leo Jay wrote:

>Thanks for all of your replies.
>
>but my problem is not how to decompile .pyo or .pyc files.
>
>i used py2exe to compile my source file `hjparser.py' into
>`hjparser.exe' and other files. but i deleted the `hjparser.py' file
>by misoperation.(of cause, i tried to recover, but failed)
>
>  
>
Have you tried downloading a file recovery tool? e.g. something here:
http://www.pcworld.com/downloads/collection/0,collid,1295,00.asp

If you havn't, you might want to try that.
I would recommend getting one for a floppy, though, as installing a 
program may overwrite the deleted data, making it nearly impossable to 
recover (at least without some kind of microscope to view the markings 
on the pins of your harddrive, but lets not get into that...).

>I opened the `hjparser.exe' file in UltraEdit(a hex editor), and found
>some partial statements and comments but not complete.
>
>so, my problem is i'm sure that the source code is in `hjparser.exe'
>but i don't know how to decompile the executable file `hjparser.exe'
>into `hjparser.py',
>  
>
Unfortuanatly i don't know how you would go about doing that.

>i don't care about how to decompile .pyo or .pyc files.
>
>  
>
Well, Python compiles .py into .pyc files when it runs them, so you may 
have a .pyc on your computer, that you didnt delete, so you may want to 
check into that, also.

>Thanks
>
>
>On 9/24/05, Ivan Voras <ivoras at __yahoo.org__> wrote:
>  
>
>>It is - py2exe embeds python bytecodes. It seems it does it in the
>>"library.zip" file (if I'm reading
>>http://starship.python.net/crew/theller/moin.cgi/Py2Exe correctly).
>>Bytecode files extracted should be decompilable to something resembling
>>original python code by a python decompiler (quick Googling finds
>>"decompyle": http://www.crazy-compilers.com/).
>>--
>>http://mail.python.org/mailman/listinfo/python-list
>>
>>    
>>
>
>
>
>--
>Best Regards,
>Leo Jay
>  
>
HTH,
Peter



More information about the Python-list mailing list