Get help from the marimo community

Home
Members
apowers313
a
apowers313
Offline, last seen last week
Joined January 17, 2025
My code creates a long-running thread in the background and I'd like to have all the output of the thread go to a single cell. Currently just the first message goes to the cell. Demo code:

Plain Text
 python
from threading import Thread
import time

def long_running():
    print("Thread starting:")
    i = 0
    while True:
        print(f"Loop {i}...")
        i += 1
        time.sleep(1)
    print("Thread exiting.")

t = Thread(target=long_running)
t.start()


Is there any way to capture the output from my thread in a specific cell?

(side note: this code also seems to cause auto export to raise an exception)
12 comments
a
A
Is there a way for my framework to detect if it is currently running in Marimo? e.g. - this is how it is done in Jupyter: https://stackoverflow.com/questions/15411967/how-can-i-check-if-code-is-executed-in-the-ipython-notebook
2 comments
a
A