on_error() missing 1 required positional argument: 'error'
See original GitHub issue- System:
Linux 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- Python3:
Python 3.5.2
- Sample-market-maker:
https://github.com/BitMEX/sample-market-maker/releases/tag/v1.5
- Running Command:
marketmaker
- Pip Freeze:
bitmex-market-maker==1.5
bitmex-ws==0.3.1
websocket-client==0.52.0
...
Error Message:
2018-10-03 23:18:00,134 - INFO - market_maker - BitMEX Market Maker Version: v1.1
2018-10-03 23:18:00,134 - INFO - ws_thread - Connecting to wss://testnet.bitmex.com/realtime?subscribe=quote:XBTUSD,trade:XBTUSD,instrument,order:XBTUSD,execution:XBTUSD,margin,position
2018-10-03 23:18:00,135 - INFO - ws_thread - Authenticating with API Key.
2018-10-03 23:18:00,136 - INFO - ws_thread - Started thread
2018-10-03 23:18:00,138 - ERROR - _logging - error from callback <bound method BitMEXWebsocket.__on_error of <market_maker.ws.ws_thread.BitMEXWebsocket object at 0x7f93a2b3e160>>: __on_error() missing 1 required positional argument: 'error'
2018-10-03 23:18:00,139 - INFO - ws_thread - Websocket Closed
2018-10-03 23:18:05,142 - ERROR - ws_thread - Couldn't connect to WS! Exiting.
- By the way, I am not sure if the version number is wrong. I downloaded the
v1.5
release but gotv1.1
while running.
Issue Analytics
- State:
- Created 5 years ago
- Comments:26
Top Results From Across the Web
Error in Python: missing 1 required positional argument
Your function "demand_curve(c,Q,y,pb)" required 4 positional arguments but you give only 3 at "demand_curve(Q_num, 50, 2)".
Read more >Python missing 1 required positional argument: 'self' Solution
The “missing 1 required positional argument: 'self'” error can occur when you incorrectly instantiate a class. Consider the following code:.
Read more >TypeError: missing 1 required positional argument: 'self'
The Python TypeError: missing 1 required positional argument: 'self' occurs when we call a method on the class instead of on an instance...
Read more >missing 1 required positional argument: 'self'
Coding example for the question I have no idea why this error: "missing 1 required positional argument: 'self'"
Read more >Learn Python Day 2, q.6 'missing 1 required positional ...
6 'missing 1 required positional argument' error. arrow_drop_up 0. The solution is given by the following code: def slowest_call(fn ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have found why, and I guess it would be applied to most people. Go to here and adding a default value for the parameter
error
.Also, if you encounter a new error(which I expect to happen) of:
2018-10-10 01:57:13,537 - ERROR - _logging - error from callback <bound method BitMEXWebsocket.__on_message of <market_maker.ws.ws_thread.BitMEXWebsocket object at 0x7ff2e327c630>>: __on_message() takes 2 positional arguments but 3 were given
Go to here, change it todef __on_message(self, ws, message):
.The parameter definiation of the
on_message
callback function of the websocketApp is here. It is clear that it will passself
to the callback, so we need to prepare a positional argument for it. But for theon_error
function, websocketApp takes theerror
argument as optional instead of positional. That’s why causes the first issue.You’re a life-saver! I fixed this issue, as noted by mikeghen, by running the following commands: