I have a big python project which I'm currently developing, and I want to make a .exe file that launches the main.py file. I have a file called ultimate_launcher.py which has the following code:
exec(open("main.py").read())
That is a solution I found somewhere on Stack Overflow. it runs fine as a .py file, but when I use pyinstaller to convert it to a .exe, it has a "Fatal" error,
Failed to execute script ultimate_launcher
I don't want the rest of my project to be put into the .exe as I am still in the process of development. So my question is how do I make a .exe that ONLY references the file main.py so when it gets updated, i don't have to remake the .exe file.
I believe there is a method to achieve this detailed in this thread:
Python - create an EXE that runs code as written, not as it was when compiled
EDIT: This works
import subprocess
f = open("c:\\temp\\temp.py", "w")
f.write(open("main.py").read())
f.close()
subprocess.call("\"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python37_64\\Scripts\\pyinstaller.exe\" --distpath \"c:\\temp\" c:\\temp\\temp.py " )
subprocess.call("C:\\temp\\temp\\temp.exe")
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments