I'm writing an installer of sorts. When a user runs my python file (compiled to executable), it downloads the actual installer then needs to run the installer and immediately exit (i.e. the real installer keeps running). My question is how do I do this bit? How do I execute the installer from the python script and exit immediately?
2 Answers
You should look at os.exec* functions:
These functions all execute a new program, replacing the current process; they do not return. On Unix, the new executable is loaded into the current process, and will have the same process id as the caller.
If you must exit the python script, may be you could use subprocess.Popen and then exit, but I am not sure about this.
1 Comment
you probably want something in the os.exec* family. Reference. You don't have to exit: these functions will replace the current program with whatever you execute, which will take over the process.