From eedd0d9c07c3da3987ee11d9683bdc22706f5673 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 23 Feb 2016 18:29:33 -0800 Subject: [PATCH] Use subprocess.Popen on windows to restart PlexPy * See python bug: https://bugs.python.org/issue19066 --- plexpy/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 82203de5..9e92bc62 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -890,7 +890,13 @@ def shutdown(restart=False, update=False): if '--nolaunch' not in args: args += ['--nolaunch'] logger.info('Restarting PlexPy with %s', args) - os.execv(exe, args) + + # os.execv fails with spaced names on Windows + # https://bugs.python.org/issue19066 + if os.name == 'nt': + subprocess.Popen(args, cwd=os.getcwd()) + else: + os.execv(exe, args) os._exit(0)