INNER CODE UNIT · Python

last_python_result

kevinpbuckley/VibeUE · Content/Python/vibeue.py:242

def last_python_result(pid=None):
    """The persisted result of the most recent execute_python_code run in THIS editor process, as a
    dict (keys: runId, pid, success, label, output, error, result, execution_time_ms, startedUtc,
    finishedUtc), or None if nothing has been recorded.

    Use after a call timed out: `execute_python_code("import vibeue; print(vibeue.last_python_result())")`
    returns the lost run because the read happens before this call's own result is persisted. Note
    that a SECOND such read reflects the first read, not the original run — use its runId with
    python_run() for a stable handle, or read it once and keep it.
    """
    try:
        with open(_last_result_path(pid), "r", encoding="utf-8") as handle:
            return json.load(handle)
    except (OSError, ValueError):
        return None


def python_run(run_id, pid=None):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…