e2b-dev / e2b-dev/code-interpreter

results.html generated HTML file has multiple issues

Open
#156 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Code Interpreter
Dominant language
Python
Stars
2.4k
Forks
228
Avg merge
48m
Merged PRs (30d)
5

Description

Issue: results.html generated HTML file has multiple issues
[1] It has only javascript content, no HTML container tags.
[2] The HTML file is so huge that it resolves CDN hosted javascript content instead of referring it.

The E2B code executed:

from dotenv import load_dotenv
load_dotenv()
from e2b_code_interpreter import Sandbox

api_key = E2B_API_KEY
code = "...."

sbx = Sandbox.create(api_key=api_key) 
execution = sbx.run_code(code)  

In [11]: execution.results
Out[11]: [Result(Formats: html), Result(Formats: html, application/vnd.plotly.v1+json)]

html_content = execution.results[0].html

In [12]: html_content
Out[12]: '        <script type="text/javascript">\n        window.PlotlyConfig = {MathJaxConfig: \'local\'};\n        if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\n        </script>\n        <script type="module">/**\n* plotly.js v3.0.1\n* Copyright 2012-2025, Plotly, Inc.\n* All rights reserved.\n* Licensed under the MIT license\n*/\n(\n function(root, factory) {\n  if (typeof module === "object" && module.exports) {\n   module.exports = factory();\n  } else {\n   root.moduleName = factory();\n  }\n} (typeof self !== "undefined" ? self : this, () => {\n"use strict";var Plotly=(()=>{var VQe=Object.create;var MS=Object.defineProperty,HQe=Object.defineProperties,GQe=Object.getOwnPropertyDescriptor,jQe=Object.getOwnPropertyDescriptors,WQ
...
....
  • The above html_content shows only javascript content, no HTML container tags.
  • It has resolved and downloaded the entire CDN hosted plotly.js within it.

The expected HTML file should have reference to CDN hosted Plotly.js file

<html>
<head><meta charset="utf-8" /></head>
<body>
    <div>                        <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>
        <script charset="utf-8" src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script>                <div id="f7c2c6fa-f9f3-40a5-a200-76f48ea8dd58" class="plotly-graph-div" style="height:100%; width:100%;"></div>            <script type="text/javascript">                                    window.PLOTLYENV=window.PLOTLYENV || {};                                    if (document.getElementById("f7c2c6fa-f9f3-40a5-a200-76f48ea8dd58")) {                    Plotly.newPlot(

References:

  • Plotly chart generation code is attached here: plotly-charts.py-
  • Expected HTML file content: top_10_gdp_pie_chart.html
  • Actual HTML file content from result.html: its huge 4 MB containing mainly plotly.js code

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached plotly-charts.py example and trace the Sandbox.run_code result path that produces results[0].html. Compare it with the expected top_10_gdp_pie_chart.html; done means the output includes HTML container tags and references CDN-hosted Plotly.js instead of embedding the full library.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, plotly, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.