apowers313
apowers313
Mmarimo
Created by apowers313 on 1/17/2025 in #help-support
Controlling output of long-running process?
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:
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()
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)
5 replies
Mmarimo
Created by apowers313 on 1/17/2025 in #help-support
Detect if running in marimo
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
4 replies