code-interpreter
code-interpreter copied to clipboard
Missing cell execution error in sandbox logs
When executing code cells the cells' error is not in the sandbox logs.
For code:
import { CodeInterpreter } from '@e2b/code-interpreter'
// Python
// const code = `import plotly.express as px
// fig = px.scatter(x=range(10), y=range(10))
// fig.write_html("test.html")`
// R
const code = `
x <- 1:6
y <- x^2
print(y)
`
console.time('create')
const ci = await CodeInterpreter.create()
console.timeEnd('create')
console.log('Sandbox ID', ci.id)
const r = await ci.notebook.execCell(code)
console.log(r)
while (true) {
await new Promise(resolve => setTimeout(resolve, 1000));
}
await ci.close()
This code will print this:
Sandbox ID itjhi72rcd8k3r4zqizmu-d6041615
Execution {
results: [],
logs: { stdout: [], stderr: [] },
error: ExecutionError {
name: 'SyntaxError',
value: 'illegal target for annotation (122535715.py, line 1)',
tracebackRaw: [
' Cell In[1], line 1\n' +
' x <- 1:6\n' +
' ^\n' +
'SyntaxError: illegal target for annotation\n'
]
},
executionCount: 1
}
But the error is not in: logs.log