Comments (8)
Thanks for reporting. This was fixed in #1870, but we haven't released it yet.
I can release soon; the fix will be in 0.7.12.
from marimo.
0.7.12 has been cut. It should be on PyPI within 30 minutes.
from marimo.
The example here no longer hangs, but it now crashes with pytest, see the output below. python mwe_hang_marimo.py
works fine, but running it from within pytest crashes.
================================================= test session starts =================================================
platform win32 -- Python 3.10.11, pytest-7.4.1, pluggy-1.3.0
rootdir: C:\Users\user\Desktop\python\moss
plugins: anyio-4.0.0, asyncio-0.21.1
asyncio: mode=strict
collected 3 items
moss\test_notebooks.py F. [ 66%]
moss\test_stuff.py . [100%]
====================================================== FAILURES =======================================================
________________________________________________ test_trivial_notebook ________________________________________________
def test_trivial_notebook():
from . import mwe_hang_marimo as notebook
> notebook.app.run()
moss\test_notebooks.py:10:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\marimo\_ast\app.py:282: in run
outputs, glbls = AppScriptRunner(InternalApp(self)).run()
..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\marimo\_runtime\app\script_runner.py:111: in run
raise e.__cause__ from None # type: ignore
..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\marimo\_runtime\executor.py:193: in execute_cell
return eval(cell.last_expr, glbls)
C:\Users\user\AppData\Local\Temp\marimo_17720\__marimo__cell_Hbol__output.py:5: in <module>
???
..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\marimo\_plugins\stateless\mpl\_mpl.py:265: in interactive
return as_html(figure)
..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\marimo\_output\formatting.py:270: in as_html
return Html(data)
..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\marimo\_output\hypertext.py:100: in __init__
flat_text = flatten_string(self._text)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
text = None
def flatten_string(text: str) -> str:
> return "".join([line.strip() for line in text.split("\n")])
E AttributeError: 'NoneType' object has no attribute 'split'
..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\marimo\_output\utils.py:17: AttributeError
=============================================== short test summary info ===============================================
FAILED moss/test_notebooks.py::test_trivial_notebook - AttributeError: 'NoneType' object has no attribute 'split'
============================================= 1 failed, 2 passed in 5.54s =============================================
from marimo.
@ggggggggg , thank you for reporting back.
I am unable to reproduce this on my machine using your MWE. But I maybe have a hunch what is happening.
Can you try something for me? Can you change mwe_hang_marimo
to the following, and let me know if pytest is still failing?
import marimo
__generated_with = "0.7.11"
app = marimo.App(width="medium")
@app.cell
def __():
import marimo as mo
import pylab as plt
plt.plot(range(100))
mo.mpl.interactive(plt.gcf())
return mo, plt
if __name__ == "__main__":
app.run()
from marimo.
Thanks for looking into it. Using the code you posted did not fix it, and I wasn't able to spot what you changed. But I did a bit more testing and have a few things that may help.
- I can reproduce the problem with this file alone
import marimo
__generated_with = "0.7.11"
app = marimo.App(width="medium")
@app.cell
def __():
import marimo as mo
import pylab as plt
plt.plot(range(100))
mo.mpl.interactive(plt.gcf())
return mo, plt
def test_trivial_notebook():
app.run()
if __name__ == "__main__":
app.run()
- It works (aka does not fail) if I put it in an empty directory and run pytest.
- It fails with the same error as before if I put it in the same directory as before, which has like 15 other python files, is part of an installed editable package, and has some random other .txt files in it.
I have to run now, but when I get back I'm going to try deleting files one by one and see if I can switch it from failing to working by doing so.
from marimo.
Oops, my mistake! I meant to replace pylab
with matplotlib.pyplot
:
import marimo
__generated_with = "0.7.11"
app = marimo.App(width="medium")
@app.cell
def __():
import marimo as mo
import matplotlib.pyplot as plt
plt.plot(range(100))
mo.mpl.interactive(plt.gcf())
return mo, plt
if __name__ == "__main__":
app.run()
Thanks for doing additional debugging. I will wait to hear back on what you find.
from marimo.
That doesn't fix it, but I now have a minimized example. You need two files in the same folder, their full contents in this gist. It's the same file I posted above, plus __init__.py
with the line import pylab as plt
. Then you run pytest
from that folder or a parent folder. This seems like the bug may not even be in marimo, but you'll know better than I.
from marimo.
Thank you. That's very helpful. I'll work on a fix.
from marimo.
Related Issues (20)
- Broken links at https://docs.marimo.io/guides HOT 4
- LaTeX displayed as raw text instead of math formulae in plotly HOT 7
- Inline math not displaying correctly in slide mode HOT 1
- Content created through JS bypasses user defined CSS HOT 4
- Configuration option to display dataframes using plain formatter
- Create a Copy Notebook Option
- Interruptible RPCs
- use external editor (e.g. neovim) for writing code, hot-reload it in the marimo editor HOT 2
- docstring popup for functions when in brackets HOT 3
- Some Firefox keyboard shortcuts are captured, while some not HOT 4
- Headings with the same name are highlighted multiple time in the table of contents
- showing a polars dataframe with array column is slow HOT 2
- mo.mpl.interactive() leaves blank figures if you're not looking HOT 3
- lazy cells (re-work of disabled cells) HOT 3
- Show Python results in Python notation HOT 2
- ipyaladin viewer style sheet issue in marimo notebooks
- "no module named pandas" when plotting Polars DataFrame with Altair HOT 2
- Assertion errors when adding a custom logging handler
- ability to disable `import *` error
- support for spyder-like view of dataframes and arrays HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marimo.