diff --git a/src/mysc/restart.py b/src/mysc/restart.py index 400ef530..cd1a0926 100644 --- a/src/mysc/restart.py +++ b/src/mysc/restart.py @@ -1,6 +1,7 @@ # -*- coding: cp1252 from __future__ import unicode_literals import sys, os +import application def restart_program(): """ Function that restarts the application if is executed.""" @@ -9,4 +10,7 @@ def restart_program(): 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) \ No newline at end of file