INNER CODE UNIT · Python

_runs_path

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

def _runs_path(pid=None):
    return os.path.join(_signals_dir(), "python-{}-runs.jsonl".format(pid or os.getpid()))


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):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…