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

WebsocketApp does not identify callback arguments correctly on 0.49.0 #463

Closed
SparkyTheAlbino opened this issue Aug 16, 2018 · 5 comments
Closed

Comments

@SparkyTheAlbino
Copy link

Using:
Python Version: Python 3.4.2
OS: Raspian Lite (Raspberry Pi Model 3B+)

When using the latest version 0.49.0 on_open, on_error, on_close all cannot see the args and therefore breaks everything and not connecting at all.

Downgrading back to 0.48.0 works fine, have been running this on another raspberry pi for quite some time now. Downgraded this new Raspberry pi to 0.48.0 and its working fine.

08/16/2018 12:58:26 PM -      ERROR: error from callback <bound method Operator.on_cxn_open of <__main__.Operator object at 0x7640b8f0>>: on_cxn_open() missing 1 required positional argument: 'ws'
  File "/usr/local/lib/python3.4/dist-packages/websocket/_app.py", line 329, in _callback
    callback(*args)

Here are few snippets from my code that may help:

self.ws = websocket.WebSocketApp(host + self.ID,
                                on_open    = self.on_cxn_open,
                                on_message = self.on_message,
                                on_error   = self.on_cxn_error,
                                on_close   = self.on_cxn_close,
                                header     = headers
                                )

    def on_cxn_open(self, ws):
        self.connected = True
        logging.info(self.ID + "---- connection opened")
        return
@swedishmike
Copy link

swedishmike commented Aug 17, 2018

@SparkyTheAlbino

I'm experiencing the same issue trying to use the certsteram library and I originally opened this issue, CaliDog/certstream-python#18, there since I thought the problem might lie in that end.

However, your issue seems to be very similar and downgrading to 0.48.0 sorts it for me as well. I saw that @nlevitt opened this pull request, #462, which sounds like it might address this issue. I tried to apply it manually and re-installed the websocket library but it didn't solve it in my end.

Have you tried that fix yet?

@swedishmike
Copy link

swedishmike commented Aug 18, 2018

I just tried with the newly pushed version 0.50.0 and certstream and the problem persists there. @SparkyTheAlbino - does that version make any difference in your end?

@nlevitt
Copy link
Contributor

nlevitt commented Aug 18, 2018

certstream subclasses WebSocketApp. It appears that #442 was intentionally a breaking change for this use case.

In other words, it looks to me like certstream needs to migrate to the new api or pin to websocket-client<=48.0, unless @liris and @bashlakov change their mind about #442.

class CertStreamClient(WebSocketApp):
    ...
    def _on_open(self, instance):
        ...

@liris
Copy link
Collaborator

liris commented Aug 18, 2018

I’m thinking it is better to revert these changes because of breaking the compatibility.

@liris
Copy link
Collaborator

liris commented Aug 19, 2018

ae58949

revert #442

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

4 participants