support of py-module in prestartup script (#1610)

This commit is contained in:
Alexander Piskun 2025-03-05 11:44:42 +03:00 committed by GitHub
parent 27706f37f6
commit 2af66d7efc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -818,6 +818,9 @@ if script_executed:
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
module_name = os.path.basename(os.path.dirname(sys_argv[0]))
cmds = [sys.executable, '-m', module_name] + sys_argv[1:]
else:
cmds = [sys.executable] + sys_argv