2014-10-27 16:29:04 -06:00
|
|
|
# -*- coding: cp1252
|
2019-06-06 11:52:23 -05:00
|
|
|
from __future__ import unicode_literals
|
2015-01-25 02:38:17 -06:00
|
|
|
import sys, os
|
2020-05-29 09:49:57 -05:00
|
|
|
import application
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def restart_program():
|
2021-06-16 16:18:41 -05:00
|
|
|
""" Function that restarts the application if is executed."""
|
|
|
|
args = sys.argv[:]
|
|
|
|
if not hasattr(sys, "frozen"):
|
|
|
|
args.insert(0, sys.executable)
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
args = ['"%s"' % arg for arg in args]
|
|
|
|
pidpath = os.path.join(os.getenv("temp"), "{}.pid".format(application.name))
|
|
|
|
if os.path.exists(pidpath):
|
|
|
|
os.remove(pidpath)
|
|
|
|
os.execv(sys.executable, args)
|