|
|
|
|
|
by simonw
383 days ago
|
|
I'm trying this out now and it's very promising. One problem I'm running into with the Python library is that I'd like to keep that sandbox running for several minutes while I do things like set variables in one call and then use them for stuff several calls later. I keep seeing this error intermittently: Error: Sandbox is not started. Call start() first
Is there a suggested way of keeping a sandbox around for longer?The documented code pattern is this: async def main():
async with PythonSandbox.create(name="my-sandbox") as sb:
exec = await sb.run("print('Hello, World!')")
print(await exec.output())
Due to the way my code works I want to instantiate the sandbox once for a specific class and then have multiple calls to it by class methods, which isn't a clean fit for that "async with" pattern.Any recommendations? |
|
There is an example of that here:
https://github.com/microsandbox/microsandbox/blob/0c13fc27ab...