question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 got v1.1 while running.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:26

github_iconTop GitHub Comments

6reactions
Microoscommented, Oct 9, 2018

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 to def __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 pass self to the callback, so we need to prepare a positional argument for it. But for the on_error function, websocketApp takes the error argument as optional instead of positional. That’s why causes the first issue.

3reactions
verata-veritatiscommented, Oct 5, 2018

@Microos, I fixed this by downgrading to websockets client version 0.47.0

You’re a life-saver! I fixed this issue, as noted by mikeghen, by running the following commands:

sudo pip3 uninstall websocket-client
sudo pip3 install websocket-client==0.47.0
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found