11

So I made a huge mistake and deleted my code file (python). The only thing I have is my python file as .exe that I created with pyinstaller. Is there a way to reverse this and to extract my code file from .exe?

1 Answers1

14

You can extract the contents of the .exe file using PyInstaller Extractor. Run it like this:

python pyinstxtractor.py executable.exe

You will then get a bunch of files, including your original python file.

Zenadix
  • 15,291
  • 4
  • 26
  • 41
  • That kinda worked, just the problem is now, that I dont have my original python file and the CMD says I can now use a python decompiler on pyc files. Where can I find one for python 3.x? – Mantas Kandratavičius Apr 12 '16 at 19:38
  • 1
    Are you sure your source file wasn't extracted? In my case, it was there but without the `.py` extension. – Zenadix Apr 12 '16 at 19:55
  • Oh god, I re-checked everything and I found it! While I'm still intrested if there are any 3.x pythong decompilers (because I was unable to find one myself) you still saved my life. – Mantas Kandratavičius Apr 12 '16 at 19:59
  • 1
    I'm glad I could help! I honestly don't know much about `pyc` to `py` decompilers, but I think [this question](http://stackoverflow.com/questions/5287253/is-it-possible-to-decompile-a-compiled-pyc-file-into-a-py-file) may be of help. – Zenadix Apr 12 '16 at 20:08
  • 2
    sorry, for my interrupt, actually, I extracted .exe using pyinstxtractor.py and I got extracted foler. So do you mean this folder include some *.py files? I hope you reply for me. Regards. – jis0324 Oct 18 '20 at 18:38
  • 2
    Hi, @Mantas Kandratavicius and Zenadix. Unfortunately, my extracted folder has no python files(.py files). Could you explain how I should do now? Regards! – jis0324 Oct 19 '20 at 03:28