467,166 Members | 1,131 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,166 developers. It's quick & easy.

How to decompile an exe file compiled by py2exe?

Dear All,

I lost my source code because of my incaution.
so anyone can tell me how to decompile the exe file compiled by py2exe?

Thanks.

--
Best Regards,
Leo Jay
Sep 24 '05 #1
  • viewed: 8714
Share:
4 Replies
Leo Jay wrote:
Dear All,

I lost my source code because of my incaution.
so anyone can tell me how to decompile the exe file compiled by py2exe?

Thanks.

--
Best Regards,
Leo Jay


If you find a program that de-compiles exe to python, it will most
likely use very ugly, c-like python because a microchip is no python
interpreter. This is based on the assumption that py2exe really
generates a pure exe and not an exe that interprets bytecode python.
be that the case, it may yield decent results, but ugly nontheless.

It might better to re-write it...

Sep 24 '05 #2
Thomas Jollans wrote:
interpreter. This is based on the assumption that py2exe really
generates a pure exe and not an exe that interprets bytecode python.
be that the case, it may yield decent results, but ugly nontheless.


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/).
Sep 24 '05 #3
Leo Jay wrote:
Dear All,

I lost my source code because of my incaution.
so anyone can tell me how to decompile the exe file compiled by py2exe?

Thanks.

--
Best Regards,
Leo Jay

In older versions of py2exe (haven't tried it for new ones) I only had
to drag the py2exe created file to my zip archiever program window.
That somehow got the program to treat the py2exe application as a zip
archieve effectively decompressing it right there in the window of the
program. This enabled me to extract the files if I wish to do so to any
place I want.

This is also valid, I noted, for the binary distributions created for
windows by the distutils.

Sep 24 '05 #4
Last I looked, py2exe only kept the byte-compiiled versions of your
files, and not the raw source.

py2exe is just an archive, you can open it up in WinZip for example
and see your .pyc/pyo files.

That gets you part of the way there ... Then you would need to find a
way to "disassemble" the byte-code.

There's this:

http://docs.python.org/lib/module-dis.html

and

http://users.cs.cf.ac.uk/J.P.Giddy/p...ecompiler.html

for inspiration ...

Doesn't look easy though.

J.F.

Leo Jay wrote:
Dear All,

I lost my source code because of my incaution.
so anyone can tell me how to decompile the exe file compiled by py2exe?

Thanks.

--
Best Regards,
Leo Jay

Sep 24 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Indigo Moon Man | last post: by
reply views Thread by John Taylor | last post: by
1 post views Thread by Ishwor | last post: by
26 posts views Thread by billiejoex | last post: by
3 posts views Thread by SPE - Stani's Python Editor | last post: by
6 posts views Thread by zdp | last post: by
reply views Thread by Karlo Lozovina | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.