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: marimo new handle long prompts (#4449)

Akshay Agrawal68d5de9fe742
diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.py
index 44ae9f8982..0453aaf45e 100644
--- a/marimo/_cli/cli.py
+++ b/marimo/_cli/cli.py
@@ -573,9 +573,13 @@ def new(
from marimo._ai.text_to_notebook import text_to_notebook
- maybe_path = Path(prompt)
- if maybe_path.is_file():
- prompt = maybe_path.read_text()
+ try:
+ _maybe_path = Path(prompt)
+ if _maybe_path.is_file():
+ prompt = _maybe_path.read_text()
+ except OSError:
+ # is_file() fails when, for example, the "filename" (prompt) is too long
+ pass
temp_file = None
try: