AsyncSandbox
- Access Linux OS
- Create, list, and delete files and directories
- Run commands
- Run isolated code
- Access the internet
AsyncSandbox.create() to create a new sandbox.
Example:
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
If no language is specified, Python is used.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executecontext: Concrete context to run the code in. If not specified, the default context for the language is used. It’s mutually exclusive with the language.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
create_code_context
cwd: Set the current working directory for the context, defaults to/home/userlanguage: Language of the context. If not specified, defaults to Pythonrequest_timeout: Timeout for the request in milliseconds
OutputMessage
line
The output line.timestamp
Unix epoch in nanosecondserror
Whether the output is an error.ExecutionError
name
Name of the error.value
Value of the error.traceback
The raw traceback of the error.to_json
MIMEType
Result
is_main_result
Whether this data is the result of the cell. Data can be produced by display calls of which can be multiple in a cell.extra
Extra data that can be included. Not part of the standard types.formats
__str__
_repr_html_
_repr_markdown_
_repr_svg_
_repr_png_
_repr_jpeg_
_repr_pdf_
_repr_latex_
_repr_json_
_repr_javascript_
Logs
stdout
List of strings printed to stdout by prints, subprocesses, etc.stderr
List of strings printed to stderr by prints, subprocesses, etc.to_json
serialize_results
Execution
results
List of the result of the cell (interactively interpreted last line), display calls (e.g. matplotlib plots).logs
Logs printed to stdout and stderr during execution.error
Error object if an error occurred, None otherwise.execution_count
Execution count of the cell.text
to_json
Context
id
The ID of the context.language
The language of the context.cwd
The working directory of the context.ChartType
ScaleType
Chart
Sandbox
- Access Linux OS
- Create, list, and delete files and directories
- Run commands
- Run isolated code
- Access the internet
Sandbox() to create a new sandbox.
Example:
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
If no language is specified, Python is used.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executecontext: Concrete context to run the code in. If not specified, the default context for the language is used. It’s mutually exclusive with the language.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
create_code_context
cwd: Set the current working directory for the context, defaults to/home/userlanguage: Language of the context. If not specified, defaults to Pythonrequest_timeout: Timeout for the request in milliseconds