Describe the bug
I'm this problem with using websocket
Task exception was never retrieved future: <Task finished coro=<ThreadedApiManager.start_listener() done, defined at /usr/local/lib/python3.7/dist-packages/binance/threaded_stream.py:42> exception=RuntimeError('Task <Task pending coro=<Queue.get() running at /usr/lib/python3.7/asyncio/queues.py:159> cb=[_release_waiter(<Future pendi...b31cd0990>()]>)() at /usr/lib/python3.7/asyncio/tasks.py:392]> got Future <Future pending> attached to a different loop')> Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/binance/threaded_stream.py", line 46, in start_listener msg = await asyncio.wait_for(s.recv(), 3) File "/usr/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/dist-packages/binance/streams.py", line 197, in recv res = await asyncio.wait_for(self._queue.get(), timeout=self.TIMEOUT) File "/usr/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/lib/python3.7/asyncio/queues.py", line 159, in get await getter RuntimeError: Task <Task pending coro=<Queue.get() running at /usr/lib/python3.7/asyncio/queues.py:159> cb=[_release_waiter(<Future pendi...b31cd0990>()]>)() at /usr/lib/python3.7/asyncio/tasks.py:392]> got Future <Future pending> attached to a different loop
I don't understand this, error.
My code:
from binance import Client, ThreadedWebsocketManager, ThreadedDepthCacheManager
client = Client('', '')
# fetch 1 minute klines for the last day up until now
klines = client.get_historical_klines("BNBBTC", Client.KLINE_INTERVAL_1MINUTE, "1 day ago UTC")
# socket manager using threads
twm = ThreadedWebsocketManager()
twm.start()
def handle_socket_message(msg):
print(f"message type: {msg['e']}")
print(msg)
twm.join()
Describe the bug I'm this problem with using websocket
Task exception was never retrieved future: <Task finished coro=<ThreadedApiManager.start_listener() done, defined at /usr/local/lib/python3.7/dist-packages/binance/threaded_stream.py:42> exception=RuntimeError('Task <Task pending coro=<Queue.get() running at /usr/lib/python3.7/asyncio/queues.py:159> cb=[_release_waiter(<Future pendi...b31cd0990>()]>)() at /usr/lib/python3.7/asyncio/tasks.py:392]> got Future <Future pending> attached to a different loop')> Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/binance/threaded_stream.py", line 46, in start_listener msg = await asyncio.wait_for(s.recv(), 3) File "/usr/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/dist-packages/binance/streams.py", line 197, in recv res = await asyncio.wait_for(self._queue.get(), timeout=self.TIMEOUT) File "/usr/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/lib/python3.7/asyncio/queues.py", line 159, in get await getter RuntimeError: Task <Task pending coro=<Queue.get() running at /usr/lib/python3.7/asyncio/queues.py:159> cb=[_release_waiter(<Future pendi...b31cd0990>()]>)() at /usr/lib/python3.7/asyncio/tasks.py:392]> got Future <Future pending> attached to a different loop
I don't understand this, error.
My code: