swift icon indicating copy to clipboard operation
swift copied to clipboard

"RuntimeError: no running event loop" cannot run any example code

Open Celppu opened this issue 1 year ago • 5 comments

Trying any example codes that uses swift.

Installed via pip with roboticstoolbox So far I have tested python versions 3.10 and 3.13 On windows and linux.

error: Exception in thread Thread-3 (SwiftSocket): Traceback (most recent call last): File "c:\Users\mee\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "c:\Users\mee\AppData\Local\Programs\Python\Python312\Lib\site-packages\ipykernel\ipkernel.py", line 766, in run_closure _threading_Thread_run(self) File "c:\Users\mee\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "c:\Users\mee\AppData\Local\Programs\Python\Python312\Lib\site-packages\swift\SwiftRoute.py", line 296, in __init__ start_server = websockets.serve(self.serve, "localhost", port) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\mee\AppData\Local\Programs\Python\Python312\Lib\site-packages\websockets\asyncio\server.py", line 737, in __init__ self.server = Server( ^^^^^^^ File "c:\Users\mee\AppData\Local\Programs\Python\Python312\Lib\site-packages\websockets\asyncio\server.py", line 281, in __init__ self.loop = asyncio.get_running_loop() ^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: no running event loop

Celppu avatar Dec 11 '24 19:12 Celppu

Added a pull request that fixes this bug

#58

renehorstmann avatar Dec 13 '24 07:12 renehorstmann

@jhavl could you take look at @renehorstmann pull request, we face same issue

AliRezaBeigy avatar Jan 11 '25 14:01 AliRezaBeigy

Fast fix

pip uninstall websockets
pip install websockets==13.1

rovalder avatar Jan 16 '25 07:01 rovalder

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

Fast fix

pip uninstall websockets pip install websockets==13.1

Hi,I had solve that issue ,by this method: but the pycharm open the google,with the error: Application error: a client-side exception has occurred (see the browser console for more information). the browser console show that : cannot open :http://localhost:52000/retrieve/D:/Program%20Files%20(x86)/Python311/Lib/site-packages/rtbdata/xacro/ur_description/meshes/ur10/visual/upperarm.dae

Error response Error code: 404 Message: File not found. Error code explanation: 404 - Nothing matches the given URI.

dewgonlong avatar Mar 29 '25 02:03 dewgonlong