Closed memsjava closed 10 months ago
Can you send a sample code when you got this error, in what case?
I also got this error with about any futures stream right now. Here is a exemple:
api_key = ""
api_secret = ""
def handle_message(message):
print(message)
futures_client = futures.HTTP(api_key = api_key, api_secret = api_secret)
ws_futures_client = futures.WebSocket(api_key = api_key, api_secret = api_secret)
print(futures_client.index_price("MX_USDT"))
ws_futures_client.deal_stream(handle_message, "MX_USDT")
while True:
pass
I got this error!
Exception in thread Thread-2 (<lambda>):
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 "/home/martin/.virtualenvs/mexc/lib/python3.10/site-packages/pymexc/base_websocket.py", line 151, in <lambda>
self.wsl = threading.Thread(target=lambda: self._ping_loop(
File "/home/martin/.virtualenvs/mexc/lib/python3.10/site-packages/pymexc/base_websocket.py", line 101, in _ping_loop
self.ws.send(ping_payload)
File "/home/martin/.virtualenvs/mexc/lib/python3.10/site-packages/websocket/_app.py", line 253, in send
raise WebSocketConnectionClosedException(
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
Fixed with commit 2e14ff8c...f044cc47
Exception in thread Thread-2 ():
Traceback (most recent call last):
File "C:\ProgramData\anaconda3\Lib\threading.py", line 1038, in _bootstrap_inner
self.run()
File "C:\ProgramData\anaconda3\Lib\threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "C:\ProgramData\anaconda3\Lib\site-packages\pymexc\base_websocket.py", line 151, in
self.wsl = threading.Thread(target=lambda: self._ping_loop(
^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\pymexc\base_websocket.py", line 101, in _ping_loop
self.ws.send(ping_payload)
File "C:\ProgramData\anaconda3\Lib\site-packages\websocket_app.py", line 253, in send
raise WebSocketConnectionClosedException(
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.