-
Notifications
You must be signed in to change notification settings - Fork 177
Closed
Description
I pass an async callback to on_error, and get the following warning:
ERROR /app/autogpt_platform/backend/.venv/lib/python3.13/site-packages/e2b_code_interpreter/models.py:444: RuntimeWarning: coroutine 'AsyncSandbox.kill' was never awaited
ERROR on_error(execution.error)
ERROR RuntimeWarning: Enable tracemalloc to get the object allocation traceback
This is because on_error, on_result etc are called but never actually awaited in parse_output:
code-interpreter/python/e2b_code_interpreter/models.py
Lines 417 to 446 in b1b4af5
| def parse_output( | |
| execution: Execution, | |
| output: str, | |
| on_stdout: Optional[OutputHandler[OutputMessage]] = None, | |
| on_stderr: Optional[OutputHandler[OutputMessage]] = None, | |
| on_result: Optional[OutputHandler[Result]] = None, | |
| on_error: Optional[OutputHandler[ExecutionError]] = None, | |
| ): | |
| data = json.loads(output) | |
| data_type = data.pop("type") | |
| if data_type == "result": | |
| result = Result(**data) | |
| execution.results.append(result) | |
| if on_result: | |
| on_result(result) | |
| elif data_type == "stdout": | |
| execution.logs.stdout.append(data["text"]) | |
| if on_stdout: | |
| on_stdout(OutputMessage(data["text"], data["timestamp"], False)) | |
| elif data_type == "stderr": | |
| execution.logs.stderr.append(data["text"]) | |
| if on_stderr: | |
| on_stderr(OutputMessage(data["text"], data["timestamp"], True)) | |
| elif data_type == "error": | |
| execution.error = ExecutionError(data["name"], data["value"], data["traceback"]) | |
| if on_error: | |
| on_error(execution.error) | |
| elif data_type == "number_of_executions": | |
| execution.execution_count = data["execution_count"] |
Metadata
Metadata
Assignees
Labels
No labels