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: toml parse error for recent notebooks (#3204)
Akshay Agrawale43b25709624
diff --git a/marimo/_server/recents.py b/marimo/_server/recents.pyindex 2d8417152a..50c278d671 100644--- a/marimo/_server/recents.py+++ b/marimo/_server/recents.py@@ -6,6 +6,7 @@ import pathlibfrom dataclasses import dataclass, fieldfrom typing import List+from marimo import _loggersfrom marimo._server.models.home import MarimoFilefrom marimo._utils.config.config import ConfigReaderfrom marimo._utils.paths import pretty_path@@ -16,8 +17,11 @@ class RecentFilesState:files: List[str] = field(default_factory=list)+# TODO(akshayka): _IGNORED_FOLDERS doesn't cover Windows_IGNORED_FOLDERS = ("/tmp", "/var")+LOGGER = _loggers.marimo_logger()+def _is_tmp_file(filename: str) -> bool:return any(@@ -39,14 +43,29 @@ class RecentFilesManager:if _is_tmp_file(filename):return- state = self.config.read_toml(- RecentFilesState, fallback=RecentFilesState()- )+ try:+ state = self.config.read_toml(+ RecentFilesState, fallback=RecentFilesState()+ )+ except Exception as e:+ LOGGER.error("Failed to read recent notebook at %s", self.LOCATION)+ LOGGER.error(str(e))+ # On error we overwrite the corrupted recents file; nothing+ # of significance is lost+ state = RecentFilesState()+if filename in state.files:state.files.remove(filename)state.files.insert(0, filename)state.files = state.files[: self.MAX_FILES]- self.config.write_toml(state)++ try:+ self.config.write_toml(state)+ except Exception as e:+ LOGGER.error(+ "Failed to write recent notebook at %s", self.LOCATION+ )+ LOGGER.error(str(e))def rename(self, old_filename: str, new_filename: str) -> None:if not self.config: