Hervé LINET
Hervé LINET2mo ago

redirect_stdout and print statements from threads

Hello, thanks for your fantastic work. I would like, in run mode, to show logs from a multithreaded library that emits logs from different threads, but can't manage to make it work with redirect_stdout. As the library is handling long running tasks, it is useful for the user to have a dynamic display of the progress. I have attached a small file to reproduce. Thanks in advance pour your help. Hervé Linet
3 Replies
Akshay
Akshay5w ago
Hey, thanks for the report. I just hit this too. The kernel's underlying runtime context is thread-local, which was convenient for us when running marimo notebooks as apps (each session runs in its own thread). Realizing now the complications this poses for regular threading ... will think of a fix.
Akshay
Akshay5w ago
GitHub
Thread-local runtime context makes I/O methods not work in notebook...
Describe the bug The runtime context is a threadlocal, which was convenient for us when running marimo notebooks as apps (each session runs in its own thread). This however means that I/O doesn&#39...
Hervé LINET
Hervé LINETOP5w ago
Hello, thanks a lot for your detailed explanations and the issue for followup.