small fix for running as py-module on windows

This commit is contained in:
bigcat88 2025-03-05 20:58:52 +02:00
parent e8c782c8e1
commit c761c6cef0
No known key found for this signature in database
GPG Key ID: 1F0BF0EC3CF22721
2 changed files with 6 additions and 6 deletions

View File

@ -1599,11 +1599,11 @@ def restart(self):
if '--windows-standalone-build' in sys_argv:
sys_argv.remove('--windows-standalone-build')
if sys.platform.startswith('win32'):
cmds = ['"' + sys.executable + '"', '"' + sys_argv[0] + '"'] + sys_argv[1:]
elif sys_argv[0].endswith("__main__.py"): # this is a python module
if sys_argv[0].endswith("__main__.py"): # this is a python module
module_name = os.path.basename(os.path.dirname(sys_argv[0]))
cmds = [sys.executable, '-m', module_name] + sys_argv[1:]
elif sys.platform.startswith('win32'):
cmds = ['"' + sys.executable + '"', '"' + sys_argv[0] + '"'] + sys_argv[1:]
else:
cmds = [sys.executable] + sys_argv

View File

@ -816,11 +816,11 @@ if script_executed:
else:
sys_argv = sys.argv.copy()
if sys.platform.startswith('win32'):
cmds = ['"' + sys.executable + '"', '"' + sys_argv[0] + '"'] + sys_argv[1:]
elif sys_argv[0].endswith("__main__.py"): # this is a python module
if sys_argv[0].endswith("__main__.py"): # this is a python module
module_name = os.path.basename(os.path.dirname(sys_argv[0]))
cmds = [sys.executable, '-m', module_name] + sys_argv[1:]
elif sys.platform.startswith('win32'):
cmds = ['"' + sys.executable + '"', '"' + sys_argv[0] + '"'] + sys_argv[1:]
else:
cmds = [sys.executable] + sys_argv