s4w3d0ff / python-poloniex

Poloniex API wrapper for Python 2.7 & 3
https://poloniex.com/support/api
GNU General Public License v2.0
568 stars 166 forks source link

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

Open OuttaSpaceTime opened 3 years ago

OuttaSpaceTime commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

I actually worked on python 3.9 though