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?
Asked
Active
Viewed 4.3k times
11
-
Is it a single-file executable (created with the `--one-file` option)? – Zenadix Apr 12 '16 at 18:22
-
yes, its is. -F -w – Mantas Kandratavičius Apr 12 '16 at 18:26
-
Try opening the executable with [7-Zip](http://www.7-zip.org/), do you find something inside? – Zenadix Apr 12 '16 at 18:33
-
Cannot open file as archive :( – Mantas Kandratavičius Apr 12 '16 at 18:52
-
Not necessary in this case, but there are data recovery programs to retrieve files cleared from the Recycle Bin. – MANA624 Apr 12 '16 at 19:39
1 Answers
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
-
1Are 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
-
1I'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
-
2sorry, 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
-
2Hi, @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