Skip to content

Debug option for errors in visualisation #2747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions mesa/visualization/solara_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import inspect
import threading
import time
import traceback
from collections.abc import Callable
from typing import TYPE_CHECKING, Literal

Expand Down Expand Up @@ -272,8 +273,8 @@ def step():
do_step()
if use_threads.value:
visualization_pause_event.set()
except Exception as e:
print(f"Error in step: {e}")
except Exception as _:
traceback.print_exc()
return

def visualization_task():
Expand All @@ -283,8 +284,8 @@ def visualization_task():
visualization_pause_event.wait()
visualization_pause_event.clear()
force_update()
except Exception as e:
print(f"Error in visualization_task: {e}")
except Exception as _:
traceback.print_exc()

solara.lab.use_task(
step, dependencies=[playing.value, running.value], prefer_threaded=True
Expand Down
Loading