AsyncSandbox
Python
- 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:
Python
run_code
Python
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 theResult
objecton_error
: Callback for theExecutionError
objectenvs
: Custom environment variablestimeout
: Timeout for the code execution in secondsrequest_timeout
: Timeout for the request in seconds
Execution
result object
run_code
Python
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 theResult
objecton_error
: Callback for theExecutionError
objectenvs
: Custom environment variablestimeout
: Timeout for the code execution in secondsrequest_timeout
: Timeout for the request in seconds
Execution
result object
run_code
Python
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 theResult
objecton_error
: Callback for theExecutionError
objectenvs
: Custom environment variablestimeout
: Timeout for the code execution in secondsrequest_timeout
: Timeout for the request in seconds
Execution
result object
create_code_context
Python
cwd
: Set the current working directory for the context, defaults to/home/user
language
: Language of the context. If not specified, defaults to Pythonrequest_timeout
: Timeout for the request in milliseconds
Sandbox
Python
- 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:
Python
run_code
Python
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 theResult
objecton_error
: Callback for theExecutionError
objectenvs
: Custom environment variablestimeout
: Timeout for the code execution in secondsrequest_timeout
: Timeout for the request in seconds
Execution
result object
run_code
Python
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 theResult
objecton_error
: Callback for theExecutionError
objectenvs
: Custom environment variablestimeout
: Timeout for the code execution in secondsrequest_timeout
: Timeout for the request in seconds
Execution
result object
run_code
Python
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 theResult
objecton_error
: Callback for theExecutionError
objectenvs
: Custom environment variablestimeout
: Timeout for the code execution in secondsrequest_timeout
: Timeout for the request in seconds
Execution
result object
create_code_context
Python
cwd
: Set the current working directory for the context, defaults to/home/user
language
: Language of the context. If not specified, defaults to Pythonrequest_timeout
: Timeout for the request in milliseconds
ChartType
Python
ScaleType
Python
Chart
Python
OutputMessage
Python
line
The output line.timestamp
Unix epoch in nanosecondserror
Whether the output is an error.ExecutionError
Python
name
Name of the error.value
Value of the error.traceback
The raw traceback of the error.to_json
Python
MIMEType
Python
Result
Python
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
Python
__str__
Python
_repr_html_
Python
_repr_markdown_
Python
_repr_svg_
Python
_repr_png_
Python
_repr_jpeg_
Python
_repr_pdf_
Python
_repr_latex_
Python
_repr_json_
Python
_repr_javascript_
Python
Logs
Python
stdout
List of strings printed to stdout by prints, subprocesses, etc.stderr
List of strings printed to stderr by prints, subprocesses, etc.to_json
Python
serialize_results
Python
Execution
Python
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
Python
to_json
Python
Context
Python