Closed sebastiang42 closed 2 years ago
Hey @sebastiang42, thanks for reporting. We need a simple and reproducible code example from you so we can test and debug this problem in our side. Otherwise it won't be possible to help you, sorry.
Hi again,
After digging even deeper, I finally found a clue that resolved the problem. I'm not exactly sure why, but rolling back my websocket-client package from version 0.58.0 to 0.57.0 fixed the problem.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
I have a script where I'm opening a websocket connection to stream Bitcoin price data from Bybit, and the script runs as expected when I run it in Spyder. However, when I try to run it in cmd or powershell, I get "X takes 1 positional argument but 2 were given" errors, and I can't figure out why. The methods in my websocket class that are giving the errors all include the "self" parameter where they're defined, e.g.: def _on_open(self): '''Log WS open.''' self.logger.debug('WebSocket opened.') self.opened = True
What steps reproduce the problem?
What is the expected output? What do you see instead?
I'm currently running a test script that opens the websocket connection, waits five seconds, then closes it again. When I run it in Spyder, I see:
2021-10-03 16:26:13 - Bybit_WS - INFO - Initializing WebSocket. 2021-10-03 16:26:14 - Bybit_WS - INFO - Subscription to trade.BTCUSD successful. 2021-10-03 16:26:19 - Bybit_WS - INFO - WebSocket closed.
but when I run it in, e.g., cmd, I see:
2021-10-03 16:51:11 - Bybit_WS - INFO - Initializing WebSocket. 2021-10-03 16:51:12 - websocket - ERROR - error from callback <bound method MyWebSocket._on_open of <Bybit_WS.MyWebSocket object at 0x000001D0FFD89790>>: _on_open() takes 1 positional argument but 2 were given 2021-10-03 16:51:12 - websocket - ERROR - error from callback <bound method MyWebSocket._on_message of <Bybit_WS.MyWebSocket object at 0x000001D0FFD89790>>: _on_message() takes 2 positional arguments but 3 were given 2021-10-03 16:51:13 - websocket - ERROR - error from callback <bound method MyWebSocket._on_message of <Bybit_WS.MyWebSocket object at 0x000001D0FFD89790>>: _on_message() takes 2 positional arguments but 3 were given 2021-10-03 16:51:15 - websocket - ERROR - error from callback <bound method MyWebSocket._on_message of <Bybit_WS.MyWebSocket object at 0x000001D0FFD89790>>: _on_close() takes 1 positional argument but 2 were given
Versions