Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html-wasm export gives unhelpful error when output is current directory and public/ is non empty #3653

Open
astrojuanlu opened this issue Feb 1, 2025 · 0 comments · May be fixed by #3661
Open
Labels
bug Something isn't working

Comments

@astrojuanlu
Copy link

Describe the bug

As per title.

Environment

{
  "marimo": "0.10.19",
  "OS": "Linux",
  "OS Version": "6.8.0-51-generic",
  "Processor": "x86_64",
  "Python Version": "3.12.3",
  "Binaries": {
    "Browser": "--",
    "Node": "v20.16.0"
  },
  "Dependencies": {
    "click": "8.1.8",
    "docutils": "0.21.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.7",
    "narwhals": "1.24.2",
    "packaging": "24.2",
    "psutil": "6.1.1",
    "pygments": "2.19.1",
    "pymdown-extensions": "10.14.3",
    "pyyaml": "6.0.2",
    "ruff": "0.9.4",
    "starlette": "0.45.3",
    "tomlkit": "0.13.2",
    "typing-extensions": "4.12.2",
    "uvicorn": "0.34.0",
    "websockets": "14.2"
  },
  "Optional Dependencies": {},
  "Experimental Flags": {}
}

Code to reproduce

uv venv -p 3.12 && source .venv/bin/activate
uv pip install marimo
marimo edit slides.py

Slides content:

$ cat slides.py
import marimo

__generated_with = "0.10.19"
app = marimo.App(width="medium")


@app.cell
def _():
    import marimo as mo
    return (mo,)


@app.cell
def _(mo):
    mo.md("""# Hello, world!""")
    return


if __name__ == "__main__":
    app.run()

Works:

marimo export html slides.py -o slides.html
marimo export html-wasm slides.py -o slides.wasm.html

Cleanup:

rm -rf *.png *.ico *.json *.webmanifest slides.html slides.wasm.html assets/

Still works:

mkdir public
touch public/foo.txt
mkdir out
marimo export html-wasm slides.py -o out/slides.wasm.html
# Cleanup
rm -r out

Fails:

$ marimo export html-wasm slides.py -o slides.wasm.html
Assets copied to . These assets are required for the notebook to run in the browser.
Traceback (most recent call last):
  File "/tmp/test-marimo-bug/.venv/bin/marimo", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/marimo/_cli/export/commands.py", line 471, in html_wasm
    did_export_public = Exporter().export_public_folder(out_dir, marimo_file)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/test-marimo-bug/.venv/lib/python3.12/site-packages/marimo/_server/export/exporter.py", line 396, in export_public_folder
    shutil.copytree(
  File "/usr/lib/python3.12/shutil.py", line 600, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/shutil.py", line 554, in _copytree
    raise Error(errors)
shutil.Error: ['<', 'D', 'i', 'r', 'E', 'n', 't', 'r', 'y', ' ', "'", 'f', 'o', 'o', '.', 't', 'x', 't', "'", '>', ' ', 'a', 'n', 'd', ' ', "'", 'p', 'u', 'b', 'l', 'i', 'c', '/', 'f', 'o', 'o', '.', 't', 'x', 't', "'", ' ', 'a', 'r', 'e', ' ', 't', 'h', 'e', ' ', 's', 'a', 'm', 'e', ' ', 'f', 'i', 'l', 'e']
@astrojuanlu astrojuanlu added the bug Something isn't working label Feb 1, 2025
@mscolnick mscolnick linked a pull request Feb 2, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant