MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / execute_get_results

Function execute_get_results

PySimpleGUI/PySimpleGUI.py:23305–23334  ·  view source on GitHub ↗

Get the text results of a previously executed execute call Returns a tuple of the strings (stdout, stderr) :param subprocess_id: a Popen subprocess ID returned from a previous execute call :type subprocess_id: (subprocess.Popen) :param timeout: Time in fractions of a seco

(subprocess_id, timeout=None)

Source from the content-addressed store, hash-verified

23303
23304
23305def execute_get_results(subprocess_id, timeout=None):
23306 """
23307 Get the text results of a previously executed execute call
23308 Returns a tuple of the strings (stdout, stderr)
23309 :param subprocess_id: a Popen subprocess ID returned from a previous execute call
23310 :type subprocess_id: (subprocess.Popen)
23311 :param timeout: Time in fractions of a second to wait. Returns '','' if timeout. Default of None means wait forever
23312 :type timeout: (None | float)
23313 :returns: Tuple with 2 strings (stdout, stderr)
23314 :rtype: (str | None , str | None)
23315 """
23316
23317 out_decoded = err_decoded = None
23318 if subprocess_id is not None:
23319 try:
23320 out, err = subprocess_id.communicate(timeout=timeout)
23321 if out:
23322 out_decoded = out.decode("utf-8")
23323 if err:
23324 err_decoded = err.decode("utf-8")
23325 except ValueError:
23326 # will get an error if stdout and stderr are combined and attempt to read stderr
23327 # so ignore the error that would be generated
23328 pass
23329 except subprocess.TimeoutExpired:
23330 # a Timeout error is not actually an error that needs to be reported
23331 pass
23332 except Exception as e:
23333 popup_error('Error in execute_get_results', e)
23334 return out_decoded, err_decoded
23335
23336
23337def execute_subprocess_still_running(subprocess_id):

Callers 2

__get_ver_pre_38Function · 0.85
__get_ver_38_laterFunction · 0.85

Calls 1

popup_errorFunction · 0.85

Tested by

no test coverage detected