A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: base64 encode vfile buffers in html export (#1441)
Akshay Agrawalda6675d65422
diff --git a/marimo/_output/utils.py b/marimo/_output/utils.pyindex 4e9e92307c..fa2a520e8a 100644--- a/marimo/_output/utils.py+++ b/marimo/_output/utils.py@@ -8,6 +8,7 @@ from marimo._messaging.mimetypes import KnownMimeTypedef build_data_url(mimetype: KnownMimeType, data: bytes) -> str:+ # `data` must be base64 encodedstr_repr = data.decode("utf-8").replace("\n", "")return f"data:{mimetype};base64,{str_repr}"diff --git a/marimo/_server/export/exporter.py b/marimo/_server/export/exporter.pyindex df6a6fd4ba..fe6d9f738d 100644--- a/marimo/_server/export/exporter.py+++ b/marimo/_server/export/exporter.py@@ -1,6 +1,7 @@# Copyright 2024 Marimo. All rights reserved.from __future__ import annotations+import base64import ioimport mimetypesimport os@@ -61,7 +62,8 @@ class Exporter:None,)files[filename_and_length] = build_data_url(- cast(KnownMimeType, mime_type), buffer_contents+ cast(KnownMimeType, mime_type),+ base64.b64encode(buffer_contents),)config = _deep_copy(DEFAULT_CONFIG)