Cross-platform application restart?

faulkner faulkner612 at comcast.net
Wed Sep 6 20:32:01 EDT 2006


asynchronously start a process which waits for the parent to close,
then starts your script.

cmd = "python -c 'import time,os;time.sleep(2);os.system(YOUR_SCRIPT)'"
if os.name == 'nt':
    cmd = 'start ' + cmd
else:
    cmd += ' &'
subprocess.Popen(cmd, shell=True)
sys.exit()

Heikki Toivonen wrote:
> Is there any way to restart a Python (GUI) application that would work
> on Windows, Mac OS X and Linux? I'd like to provide a "restart" button
> to a dialog that would restart the application to pick new changes or
> start with different options.
> 
> -- 
>   Heikki Toivonen




More information about the Python-list mailing list