Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket not working as expeced for the latest version: _on_close() takes 2 positional arguments but 4 were given #214

Open
OuttaSpaceTime opened this issue Jun 23, 2021 · 2 comments

Comments

@OuttaSpaceTime
Copy link

Hey,

I have the following code for my websocket:

    def start_ws(self):
        self.ws = websocket.WebSocketApp(self.wss_url, on_open=self.on_open, on_close=self.on_close,
                                         on_error=self.on_error, on_message=self.on_message)
        self.ws.run_forever()

    def on_open(self, ws):
        logger.info("Binance connection opened")

    def on_close(self, ws):
        logger.warning("Binance connection closed")

    def on_error(self, ws, msg):
        logger.error("Binance connection error: %s", msg)

when I start websocket like so within in my __init__ method:

        threading.Thread(target=self.start_ws).start()

I get the error:

2021-06-21 11:12:18,826 ERROR :: error from callback <bound method Client._on_close of <connectors.client.Client object at 0x0000028C93FDD130>>: _on_close() takes 2 positional arguments but 4 were given

Any idea what is going on here and why is it not working? I also can't see where 4 were given. It only seems be working when I go back version 0.58
How would I have to use it within the latest version?

@s4w3d0ff
Copy link
Owner

Ive updated the master branch, seems websocket-client has dropped support for older versions of python recently. I changed the setup file to require 0.59.0 which is the last version to support the older python versions

@OuttaSpaceTime
Copy link
Author

I actually worked on python 3.9 though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants