diff --git a/examples/code-interpreter/Dockerfile b/examples/code-interpreter/Dockerfile index e1ee74d8..23f1fb74 100644 --- a/examples/code-interpreter/Dockerfile +++ b/examples/code-interpreter/Dockerfile @@ -1 +1 @@ -FROM docker.io/cloudflare/sandbox:0.6.1 +FROM docker.io/cloudflare/sandbox:0.6.1-python diff --git a/examples/code-interpreter/src/index.ts b/examples/code-interpreter/src/index.ts index 5d6e6bfe..9068ffd2 100644 --- a/examples/code-interpreter/src/index.ts +++ b/examples/code-interpreter/src/index.ts @@ -43,7 +43,7 @@ async function callCloudflareAPI( async function executePythonCode(env: Env, code: string): Promise { const sandboxId = env.Sandbox.idFromName('default'); - const sandbox = getSandbox(env.Sandbox, sandboxId.toString()); + const sandbox = getSandbox(env.Sandbox, sandboxId.toString().slice(0, 63)); const pythonCtx = await sandbox.createCodeContext({ language: 'python' }); const result = await sandbox.runCode(code, { context: pythonCtx diff --git a/examples/minimal/src/index.ts b/examples/minimal/src/index.ts index 067a1a7a..e055831a 100644 --- a/examples/minimal/src/index.ts +++ b/examples/minimal/src/index.ts @@ -9,9 +9,9 @@ export default { // Get or create a sandbox instance const sandbox = getSandbox(env.Sandbox, 'my-sandbox'); - // Execute Python code + // Execute a shell command if (url.pathname === '/run') { - const result = await sandbox.exec('python3 -c "print(2 + 2)"'); + const result = await sandbox.exec('echo "2 + 2 = $((2 + 2))"'); return Response.json({ output: result.stdout, error: result.stderr,