RuntimeError: can't register atexit after shutdown

982 views
Skip to first unread message

Ben Carter

unread,
Jan 10, 2022, 1:47:14 PM1/10/22
to VPython-users
This is probably some really dumb n00b problem, but I've just started to use VPython (with installed Python) and this error is what happens. I do only this in a method:
from vpython import box
box()

and call it from main(). The box appears in the browser window, but the Python console shows this error message anytime I move the object in the browser.

Is there something I need to do? I couldn't find any documentation on this on the VPython homepage. Thanks.

That's what shows up on the console (only the last few lines shown)
future: <Task finished name='Task-1941' coro=<WSserver.onMessage() done, defined at /home/werner/PycharmProjects/evolution/venv/lib/python3.9/site-packages/vpython/no_notebook.py:181> exception=RuntimeError("can't register atexit after shutdown")>
Traceback (most recent call last):
  File "/home/werner/PycharmProjects/evolution/venv/lib/python3.9/site-packages/vpython/no_notebook.py", line 214, in onMessage
    await loop.run_in_executor(None, GW.handle_msg, msg)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 809, in run_in_executor
    executor = concurrent.futures.ThreadPoolExecutor(
  File "/usr/lib/python3.9/concurrent/futures/__init__.py", line 49, in __getattr__
    from .thread import ThreadPoolExecutor as te
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 37, in <module>
    threading._register_atexit(_python_exit)
  File "/usr/lib/python3.9/threading.py", line 1407, in _register_atexit
    raise RuntimeError("can't register atexit after shutdown")
RuntimeError: can't register atexit after shutdown

Process finished with exit code 0

Ben Carter

unread,
Jan 11, 2022, 4:44:23 AM1/11/22
to VPython-users
Ok, fixed it myself. It was indeed a ridiculous n00b error. The problem is simply, that the main() routine terminated, while the rendered image was still available and every interaction with it produced this error message. Once I created an infinite loop in the main() method, the error is gone.
Reply all
Reply to author
Forward
0 new messages