Skip to content

Commit bee4a2b

Browse files
authored
Merge pull request PySimpleGUI#4936 from PySimpleGUI/Dev-latest
Changed the execute_py_file and execute_py_get_interpreter to return …
2 parents 8b52b8b + 0b3340e commit bee4a2b

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

PySimpleGUI.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/python3
2-
version = __version__ = "4.54.0 Released 6-Nov-2021"
2+
version = __version__ = "4.54.0.1 Unreleased"
33

44
_change_log = """
55
Changelog since 4.54.0 released to PyPI on 6-Nov-2021
6+
7+
4.54.0.1
8+
Changed the Exec start subprocess/ run py file to use the sys.executable
69

710

811
"""
@@ -20556,10 +20559,12 @@ def execute_py_file(pyfile, parms=None, cwd=None, interpreter_command=None, wait
2055620559
if interpreter_command is not None:
2055720560
python_program = interpreter_command
2055820561
else:
20559-
pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
20560-
python_program = pysimplegui_user_settings.get('-python command-', '')
20561-
if python_program == '':
20562-
python_program = 'python' if running_windows() else 'python3'
20562+
# use the version CURRENTLY RUNNING if nothing is specified. Previously used the one from the settings file
20563+
python_program = sys.executable
20564+
# pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
20565+
# python_program = pysimplegui_user_settings.get('-python command-', '')
20566+
# if python_program == '':
20567+
# python_program = 'python' if running_windows() else 'python3'
2056320568
if parms is not None and python_program:
2056420569
sp = execute_command_subprocess(python_program, pyfile, parms, wait=wait, cwd=cwd, pipe_output=pipe_output, merge_stderr_with_stdout=merge_stderr_with_stdout)
2056520570
elif python_program:
@@ -20572,16 +20577,16 @@ def execute_py_file(pyfile, parms=None, cwd=None, interpreter_command=None, wait
2057220577

2057320578
def execute_py_get_interpreter():
2057420579
"""
20575-
Returns the command that was specified in the global options that will be used to execute Python files
20576-
when the execute_py_file function is called.
20577-
20580+
Returns the command that is currently running. Previously returned the one from the system settings, but
20581+
have determined that the one currently running is the better choice.
2057820582

20579-
:return: Full path to python interpreter or '' if nothing entered
20583+
:return: Full path to python interpreter (uses sys.executable)
2058020584
:rtype: (str)
2058120585
"""
20582-
pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
20583-
interpreter = pysimplegui_user_settings.get('-python command-', '')
20584-
return interpreter
20586+
return sys.executable
20587+
# pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
20588+
# interpreter = pysimplegui_user_settings.get('-python command-', '')
20589+
# return interpreter
2058520590

2058620591

2058720592
def execute_editor(file_to_edit, line_number=None):

0 commit comments

Comments
 (0)