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.

fix: windows paths for persistent cache (#5723)

Dylan Madisettibdb44f2f69ca
diff --git a/marimo/_save/loaders/loader.py b/marimo/_save/loaders/loader.py
index df9502106a..f91fd6a839 100644
--- a/marimo/_save/loaders/loader.py
+++ b/marimo/_save/loaders/loader.py
@@ -1,6 +1,7 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
+import re
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional
@@ -189,7 +190,8 @@ class BasePersistenceLoader(Loader):
except ContextNotInitializedError:
self.store = DEFAULT_STORE()
- self.name = name
+ # Limited character set for path for windows compatibility
+ self.name = re.sub(r"[^a-zA-Z0-9 _-]", "_", name)
self.suffix = suffix
def build_path(self, key: HashKey) -> Path: