2

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 2

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. You get the accepted as you answered first. Exactly what I needed.
2

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.

1 Comment

+1 as I know what it feels like for somebody else to slip the same correct answer in just before me. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.