e2b-dev / code-interpreter

Python & JS/TS SDK for adding code interpreting to your AI app
https://e2b.dev
Apache License 2.0
1.08k stars 71 forks source link

Missing cell execution error in sandbox logs #26

Open ValentaTomas opened 2 months ago

ValentaTomas commented 2 months ago

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

ValentaTomas commented 1 month ago

We changes how the CI logging works, so we should check if this is still a problem.