I get this error: Task exception was never retrieved. What can I do?

97 views
Skip to first unread message

J.-Henning Friz

unread,
Mar 24, 2023, 3:55:23 AM3/24/23
to Glowscript Users
I have succesfully installed vpython. I have vpython 7.6.4, python3.10 and I am using the newest version of Pycharm community (if this does matter). To test if it works I ran
from vpython import *
sphere

This worked and a browser opened with the sphere. In the terminal I got this message in red text though. What am I supposed to change to not get those messages? Have I done something wrong?
thank you in advance & greetings
Henning

Here the error:
Task exception was never retrieved
future: <Task finished name='Task-24' coro=<WSserver.onMessage() done, defined at /home/henning/PycharmProjects/vpython/lib/python3.10/site-packages/vpython/no_notebook.py:181> exception=RuntimeError("can't register atexit after shutdown")>
Traceback (most recent call last):
  File "/home/henning/PycharmProjects/vpython/lib/python3.10/site-packages/vpython/no_notebook.py", line 214, in onMessage
    await loop.run_in_executor(None, GW.handle_msg, msg)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 813, in run_in_executor
    executor = concurrent.futures.ThreadPoolExecutor(
  File "/usr/lib/python3.10/concurrent/futures/__init__.py", line 49, in __getattr__
    from .thread import ThreadPoolExecutor as te
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 37, in <module>
    threading._register_atexit(_python_exit)
  File "/usr/lib/python3.10/threading.py", line 1504, in _register_atexit
    raise RuntimeError("can't register atexit after shutdown")
RuntimeError: can't register atexit after shutdown
Task exception was never retrieved
future: <Task finished name='Task-26' coro=<WSserver.onMessage() done, defined at /home/henning/PycharmProjects/vpython/lib/python3.10/site-packages/vpython/no_notebook.py:181> exception=RuntimeError("can't register atexit after shutdown")>
Traceback (most recent call last):
  File "/home/henning/PycharmProjects/vpython/lib/python3.10/site-packages/vpython/no_notebook.py", line 214, in onMessage
    await loop.run_in_executor(None, GW.handle_msg, msg)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 813, in run_in_executor
    executor = concurrent.futures.ThreadPoolExecutor(
  File "/usr/lib/python3.10/concurrent/futures/__init__.py", line 49, in __getattr__
    from .thread import ThreadPoolExecutor as te
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 37, in <module>
    threading._register_atexit(_python_exit)
  File "/usr/lib/python3.10/threading.py", line 1504, in _register_atexit
    raise RuntimeError("can't register atexit after shutdown")
RuntimeError: can't register atexit after shutdown
Exception ignored in atexit callback: <function Exit at 0x7f58e99ad480>
Traceback (most recent call last):
  File "/home/henning/PycharmProjects/vpython/lib/python3.10/site-packages/vpython/vpython.py", line 22, in Exit
    a = 1.0/zero
ZeroDivisionError: float division by zero

J.-Henning Friz

unread,
Mar 24, 2023, 4:04:17 AM3/24/23
to Glowscript Users
If I add a this at the end of the script, as some people recommended in other conversations:
While True: rate(30)

the error gets shorter. Then it only says:

xception ignored in atexit callback: <function Exit at 0x7f8bc5d75480>

Traceback (most recent call last):
  File "/home/henning/PycharmProjects/vpython/lib/python3.10/site-packages/vpython/vpython.py", line 22, in Exit
    a = 1.0/zero
ZeroDivisionError: float division by zero

Bruce Sherwood

unread,
Mar 24, 2023, 1:36:06 PM3/24/23
to Glowscript Users
It would be useful to launch the program from something other than Pycharm to see what happens. Try running from IDLE or from a terminal.

As for the rate statement, here is what is stated in the installation instructions at vpython.org:

When running from a terminal, if the program does not end with a loop
containing a rate() statement, you need to add "while True: rate(30)"
to the end of the program. This is not necessary when launching from
environments such as Jupyter notebook, IDLE, or Spyder.

Bruce
Reply all
Reply to author
Forward
0 new messages