swift icon indicating copy to clipboard operation
swift copied to clipboard

RuntimeError: no running event loop

Open paryasoleimani opened this issue 1 year ago • 2 comments

Hey, dear Devs. I was recently testing a robotic example Colab Link running on Swift. It strangely gave me the following error: "Async event loop already running. Adding coroutine to the existing event loop." Exception in thread Thread-11 (SwiftSocket): Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.10/dist-packages/swift/SwiftRoute.py", line 296, in __init__ start_server = websockets.serve(self.serve, "localhost", port) File "/usr/local/lib/python3.10/dist-packages/websockets/asyncio/server.py", line 737, in __init__ self.server = Server( File "/usr/local/lib/python3.10/dist-packages/websockets/asyncio/server.py", line 281, in __init__ self.loop = asyncio.get_running_loop() RuntimeError: no running event loop"

Or it stuck on loading for a long amount of time . How should I solve this?

I really appreciate any help you can provide.

paryasoleimani avatar Jan 11 '25 20:01 paryasoleimani

hello @paryasoleimani , please check #57 , which provides a solution to your issue

tassos avatar Feb 19 '25 19:02 tassos

Hi,I had solve that issue ,by this method: my code: _import roboticstoolbox as rtb

model = rtb.models.URDF.UR10() print(model) qz = [0,30,-30,0,0,0] model.plot(qz,backend = 'swift')_

fast fix pip uninstall websockets pip install websockets==13.1

but the pycharm open with the google,with the error: Application error: a client-side exception has occurred (see the browser console for more information).

dewgonlong avatar Mar 28 '25 11:03 dewgonlong