How to turn your .exe files to .py files again!
The method to turn your precious coded games/applications into Python code again!
Note: This method will only work if you created the .exe file using the module name pyinstaller!
Introduction
So yesterday, I accidentally deleted the code for my game that I programmed using python!
At first, I thought that the code would be in the recycle bin and I would recycle it later but then I realized that I had made quite a huge mistake by leaving the work for later because I regularly install newer versions of windows on my computer!
Well, I just installed the latest version of Windows 11(24H2) on my computer and I completely forgot about the code sitting in the recycle bin Viola the code was gone and I didn’t even realize it until today!
So, I spent 2 hours trying to recover my code from the exe file, and finally with the power of Reddit I was able to recover my code and make some adjustments to it!
Decoding the exe file
First of all, you have to download the GitHub repository for pyinstxtractor here!
Then you have to install Python from the original website here!
I use Anaconda to install Python because you can create many environments in it and it is really helpful in many tasks. If you want to use Anaconda you can download it from right here!
Then you have to run the script that you just downloaded from Github provide the filename of the .exe file and make sure the file is in the same directory as the script!
Then you will see another directory pop-up in the same folder! By navigating into the new folder you will see many files but one file will be named as the name as the exe file!
But there is a problem here, the file is in .pyc format! Don’t worry if you see a file in this format, this just means that you are on the right track! Now you have to head over to Pylingual, you can get the link here!
Now here you have to upload the .pyc file that you obtained from running the GitHub script! After uploading the file you will have to wait for a minute for the website to actually decode the .pyc format. After the decoding is done the decoded file will be available for download!
And Viola there you go, you now have your Python code again with you! Have a great day!