How to decompile an exe file compiled by py2exe?

Chris Lambacher lambacck at
Mon Sep 26 17:43:55 CEST 2005

On Sat, Sep 24, 2005 at 09:29:30PM +0800, Leo Jay wrote:
> Thanks for all of your replies.
> but my problem is not how to decompile .pyo or .pyc files.
Eventually that is what the problem will become.  hjparser.exe is a python
interpreter that runs a python module that it extracts from itself.  In other
words there are two steps to this.  Step one is to extract the .pyc file that
is embedded in hjparser.exe. The second step is to decompile the .pyc into
something that resembles your original file.

You may have some luck determining how to extract the .pyc file by examining
the source for py2exe, either for the creation of the exe or the exe itself.

> i used py2exe to compile my source file `' into
> `hjparser.exe' and other files. but i deleted the `' file
> by misoperation.(of cause, i tried to recover, but failed)
> 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 `',
> i don't care about how to decompile .pyo or .pyc files.
> 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
> > "" file (if I'm reading
> > correctly).
> > Bytecode files extracted should be decompilable to something resembling
> > original python code by a python decompiler (quick Googling finds
> > "decompyle":
> > --
> >
> >
> --
> Best Regards,
> Leo Jay
> -- 

More information about the Python-list mailing list