slazarov / python-signalr-client

SignalR client for python based on asyncio.
MIT License
33 stars 22 forks source link

Python 3.10 incompatible #23

Open Serpens66 opened 1 year ago

Serpens66 commented 1 year ago

I'm trying to run the sample code from bittrex, which uses your library: https://bittrex.github.io/api/v3#topic-Example-Socket-Clients

But I get this error: TypeError: As of 3.10, the loop parameter was removed from Queue() since it is no longer necessary

traceback: Traceback (most recent call last): File "...\V3WebsocketExample.py", line 127, in asyncio.run(main()) File "...\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "...\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete return future.result() File "...\V3WebsocketExample.py", line 32, in main await connect() File "...\V3WebsocketExample.py", line 43, in connect connection = Connection(URL) File "...\Python310\lib\site-packages\signalr_aio_connection.py", line 24, in init self.transport = Transport(self) File "...\Python310\lib\site-packages\signalr_aio\transports_transport.py", line 34, in init self._set_loop() File "...\Python310\lib\site-packages\signalr_aio\transports_transport.py", line 42, in _set_loop self.invoke_queue = asyncio.Queue(loop=self.ws_loop) File "...\Python310\lib\asyncio\queues.py", line 34, in init super().init(loop=loop) File "...\Python310\lib\asyncio\mixins.py", line 17, in init__ raise TypeError( TypeError: As of 3.10, the loop parameter was removed from Queue() since it is no longer necessary

Serpens66 commented 1 year ago

this is how websockets solved it (to have the code compatible with lower and higher python versions): https://github.com/aaugustin/websockets/blob/9e960b508988c4049eb9f3377c505f506a3af060/src/websockets/legacy/compatibility.py#L10