Skip to content

mo.watch.file not supported on wasm #7956

@rambip

Description

@rambip

Describe the bug

I had a great time playing with mo.watch.file (like creating typst svg documents on the fly).

But after trying to package it on marimo.app to share it, I got this error:

Unsupported stream type <class 'marimo._pyodide.streams.PyodideStream'>

It makes sense that the Pyodide filesystem is not as powerful as the host, but this limitation was never documented.

IMO, the function should be able to read the contents in wasm, and just return a warning in the case where the pyodide filesystem is too limited to be reactive.

Thank's !

Will you submit a PR?

  • Yes

Environment

Details
{
  "marimo": "0.19.4",
  "editable": false,
  "location": "/var/mnt/data/Proj/marimo-website/.venv/lib/python3.13/site-packages/marimo",
  "OS": "Linux",
  "OS Version": "6.18.5-200.fc43.x86_64",
  "Processor": "",
  "Python Version": "3.13.9",
  "Locale": "en_US",
  "Binaries": {
    "Browser": "--",
    "Node": "v24.11.1"
  },
  "Dependencies": {
    "click": "8.3.1",
    "docutils": "0.22.4",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.10",
    "narwhals": "2.15.0",
    "packaging": "25.0",
    "psutil": "7.2.1",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.20",
    "pyyaml": "6.0.3",
    "starlette": "0.52.1",
    "tomlkit": "0.14.0",
    "typing-extensions": "4.15.0",
    "uvicorn": "0.40.0",
    "websockets": "16.0"
  },
  "Optional Dependencies": {
    "altair": "6.0.0",
    "loro": "1.10.3",
    "openai": "2.15.0",
    "polars": "1.37.1",
    "ruff": "0.14.13",
    "ty": "0.0.12",
    "watchdog": "6.0.0"
  },
  "Experimental Flags": {}
}

Code to reproduce

import marimo as mo
mo.file.watch("file.txt")

Here is the entire stacktrace of the wasm execution:

Traceback (most recent call last):
  File "/tmp/marimo_42/__marimo__cell_lcWz_.py", line 1, in <module>
    mo.watch.file("file.txt")
  File "/lib/python3.12/site-packages/marimo/_runtime/watch/_file.py", line 148, in file
    return FileState(path, allow_self_loops=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/marimo/_runtime/watch/_file.py", line 67, in __init__
    super().__init__(*args, **kwargs)
  File "/lib/python3.12/site-packages/marimo/_runtime/watch/_path.py", line 74, in __init__
    Thread(
  File "/lib/python3.12/site-packages/marimo/_runtime/threads.py", line 101, in __init__
    raise RuntimeError(
RuntimeError: Unsupported stream type <class 'marimo._pyodide.streams.PyodideStream'>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions