marimo
marimo copied to clipboard
Confusing error related to UI element deletion
Describe the bug
Exception ignored in: <function UIElement.__del__ at 0x108939940>
Traceback (most recent call last):
File "/Users/delenn/.pyenv/versions/notebook/lib/python3.11/site-packages/marimo/_plugins/ui/_core/ui_element.py", line 213, in __del__
ctx.ui_element_registry.delete(self._id, id(self))
^^^^^^^^
AttributeError: 'table' object has no attribute '_id'
(Reported by a user)
Environment
{
"marimo": "0.1.65",
"OS": "Darwin",
"OS Version": "22.6.0",
"Processor": "arm",
"Python Version": "3.11.4",
"Binaries": {
"Chrome": "120.0.6099.71",
"Node": "v20.3.1"
},
"Requirements": {
"black": "23.10.1",
"click": "8.1.7",
"jedi": "0.19.1",
"pymdown-extensions": "10.3.1",
"tomlkit": "0.12.1",
"tornado": "6.3.3",
"typing_extensions": "4.8.0"
}
}
Code to reproduce
Difficult to reproduce ...
I see something like this when I'm running a marimo notebook as a script (e.g. python marimo_nb.py), and the notebook has marimo Html objects as cell outputs.
I'm running marimo 0.2.13.
Traceback (most recent call last):
File "...", line 202, in <module>
app.run()
File ".../.venv/lib/python3.11/site-packages/marimo/_ast/app.py", line 249, in run
return asyncio.run(self._run_async())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/marimo/_ast/app.py", line 230, in _run_async
outputs[cid] = await execute_cell_async(cell._cell, glbls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/marimo/_ast/cell.py", line 386, in execute_cell_async
return eval(cell.last_expr, glbls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/folders/_3/3t5t8_n5705dj1tp8hx0m6fw0000gq/T/marimo_40945/__marimo__cell_bkHC__output.py", line 45, in <module>
File ".../.venv/lib/python3.11/site-packages/marimo/_plugins/ui/_impl/table.py", line 170, in __init__
Function(
File ".../.venv/lib/python3.11/site-packages/marimo/_runtime/functions.py", line 42, in __init__
ctx = get_context()
^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/marimo/_runtime/context.py", line 142, in get_context
raise ContextNotInitializedError
marimo._runtime.context.ContextNotInitializedError
Exception ignored in: <function UIElement.__del__ at 0x10613e8e0>
Traceback (most recent call last):
File ".../.venv/lib/python3.11/site-packages/marimo/_plugins/ui/_core/ui_element.py", line 241, in __del__
File ".../.venv/lib/python3.11/site-packages/marimo/_output/hypertext.py", line 95, in __del__
My hunch is that this is a family of bugs related to errors encountered during script execution. I can open a new issue if that's preferred.