Skip to content

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.

Specify the encoding for reading files to keep from encoding error for some Asian Windows platform. (#3868)

黃昕暐46c1d8d02fae
diff --git a/marimo/_cli/file_path.py b/marimo/_cli/file_path.py
index c22c8dc19c..b0b549df48 100644
--- a/marimo/_cli/file_path.py
+++ b/marimo/_cli/file_path.py
@@ -58,7 +58,7 @@ class LocalFileReader(FileReader):
# Is directory
if os.path.isdir(name):
return "", os.path.basename(name)
- with open(name, "r") as f:
+ with open(name, "r", encoding="utf-8") as f:
content = f.read()
return content, os.path.basename(name)
diff --git a/marimo/_config/manager.py b/marimo/_config/manager.py
index 829d1756fb..a7a8d81e80 100644
--- a/marimo/_config/manager.py
+++ b/marimo/_config/manager.py
@@ -162,7 +162,7 @@ class ScriptConfigManager(PartialMarimoConfigReader):
from marimo._utils.scripts import read_pyproject_from_script
- script_content = filepath.read_text()
+ script_content = filepath.read_text(encoding="utf-8")
script_config = read_pyproject_from_script(script_content)
if script_config is None:
return {}