Changed so that Linux version works the same as Windows

This commit is contained in:
PySimpleGUI 2020-10-30 18:18:26 -04:00
parent 9ef9e28603
commit 977bc66196
1 changed files with 8 additions and 4 deletions

View File

@ -251,10 +251,14 @@ def run(app_name, parm=''):
def run_py(pyfile, parms=None):
if parms is not None:
execute_command_subprocess('python', pyfile, parms)
if sys.platform == 'linux':
cmd = 'python3'
else:
execute_command_subprocess('python', pyfile)
cmd = 'python'
if parms is not None:
execute_command_subprocess(cmd, pyfile, parms)
else:
execute_command_subprocess(cmd, pyfile)
def execute_command_subprocess(command, *args, wait=False):
@ -262,7 +266,7 @@ def execute_command_subprocess(command, *args, wait=False):
arg_string = ''
for arg in args:
arg_string += ' ' + str(arg)
sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
sp = subprocess.Popen([command + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
expanded_args = ' '.join(args)
sp = subprocess.Popen([command, expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)