Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to convert a .exe file to .py?

I created an executable file (.exe file) of a python script.

I lost the folder with the original python script (also no backups), due to disk formatting.

By chance I got its executable file on the drive.

Can I re-convert it to the python script?

like image 396
Nirmal Avatar asked Jan 27 '23 12:01

Nirmal


1 Answers

No, what you dream of is called a decompiler, and cannot really exist (in a reliable and systematic way) for Python (and for most programming languages and their implementations, because they are not homoiconic). Consider that your Python source code is lost (but see also this: analyzing your executable would take a lot of time, a lot of skills, so is practically not worth the effort).

Learn to use a version control system (for your future source code). I recommend git. Make backups. Even better, publish your software with a free software license (e.g. on github or elsewhere) while you are developping it.

You could also pay a lot of money (perhaps thousands of € or US$) to ask some specialized companies to recover data (hopefully also your lost source code) from your crashed disk drive. This is usually not worth the money.

like image 197
Basile Starynkevitch Avatar answered Feb 03 '23 17:02

Basile Starynkevitch