8

I lost my original python code that I've been working on for months, it's packed into an .exe using PyInstaller and that's all I have.

I tried this: Exe to python with pyinstaller?

I was able to extract a file that has some of my source code in it but it's filled with all this gibberish:

Graphing...

z Value="é z0" MÚ0c C s g | ]}|  d d¡qS )ú"Ú )Ú replace)Ú.0Ús© r úGraphLEDView_1.1.pyú ( s r c C s g | ]}t  d d|¡qS )z[^0-9]r )ÚreÚsub)r Ú LedDatar r r
r ) s )Údtype)é g @)Ú figsizei¸ é z Sensor {}g ü?)ÚlabelÚ linewidthÚLEDsÚ BrightnessÚlogz

What was extracted was a file with the name of my code without the .py extension and a folder of .pyc files none of which are my code, just the dependent libraries. Can someone help me get my code back? A lot of work down the drain if I can't get it back... I feel really dumb. Thanks

Adam Dev
  • 81
  • 1
  • 3
  • Looks like maybe another viable tool at https://github.com/countercept/python-exe-unpacker – G. Anderson Mar 21 '19 at 22:25
  • Thanks. I just tried it by going: python python_exe_unpack.py -i myprogram.exe, and I got an error, TypeError: extractFiles() takes 1 positional argument but 2 were given – Adam Dev Mar 21 '19 at 22:45
  • Unfortunately, I haven't personally used this program, you might try reaching out to the developer. Sorry I can't be of more help! – G. Anderson Mar 22 '19 at 15:06
  • Do you use ``onefile`` or ``onedir`` for packaging? (It looks like ``onefile``) can you provide the complete file for download? – Carson Apr 20 '20 at 02:06
  • and provide your python version: for example, Python 3.7.7(``python --version``) and packages information (``pip freeze``) – Carson Apr 20 '20 at 02:33
  • I put in a pull request to fix the error you have here: https://github.com/countercept/python-exe-unpacker/pull/16 - The version with the fix is forked here: https://github.com/johnashu/python-exe-unpacker – johnashu Apr 20 '20 at 12:55

1 Answers1

0

It doesn't seem to be possible. Pyinstaller converts the .py file into binary which your computer can understand. From what I can see, there isn't a way to convert the .exe to a .py file again.

  • 1
    What you say is incorrect. **It is possible** to convert .exe to .py. Here - [Converting .exe to .py](https://stackoverflow.com/questions/51227091/how-to-convert-exe-back-to-python-script) – PCM Jun 26 '21 at 06:11