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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webserver WebSocket (start client) error #382

Open
dale3h opened this issue May 9, 2019 · 2 comments
Open

Webserver WebSocket (start client) error #382

dale3h opened this issue May 9, 2019 · 2 comments
Labels

Comments

@dale3h
Copy link

dale3h commented May 9, 2019

Save yourself the time and just scroll down if you care only about the cause and/or how to fix. 馃槃

Bug Description

After upgrading from 0.4.1.r1722 to 0.5.0-rc6, I immediately noticed an error on startup pertaining to starting a WebSocket client on the Webserver plugin. The error output below is from 0.5.0-beta1 (the first version that I could find in which it is broken), but it is virtually the same output as 0.5.0-rc6:

16:56:38      Webserver: Start client: EGProxy
16:56:38         Error in Action: "Webserver: Start client: EGProxy"
16:56:38         Traceback (most recent call last) (0.5.0-beta1):
16:56:38           File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
16:56:38             return self(*args)
16:56:38           File "C:\Program Files (x86)\EventGhost\plugins\Webserver\__init__.py", line 4486, in __call__
16:56:38             self.plugin.StartClient(title, url, login, password, noCert)
16:56:38           File "C:\Program Files (x86)\EventGhost\plugins\Webserver\__init__.py", line 4118, in StartClient
16:56:38             wsC = WebSocketClient(title, url, login, password, noCert, self)
16:56:38           File "C:\Program Files (x86)\EventGhost\plugins\Webserver\__init__.py", line 242, in __init__
16:56:38             WebSocketApp.__init__(self, url, **kwargs)
16:56:38         TypeError: __init__() got an unexpected keyword argument 'on_open'

Steps to Reproduce

Please forgive my verbose instructions here. I just want to make sure everything is covered.

  1. Click the Autostart group in the main configuration tree.
  2. Click on the Configuration menu and select Add Plugin... (Shift+Ctrl+P).
  3. Under the group Other, select Webserver and click OK. (The plugin version will vary depending on the EG release.)
  4. On the Plugin Item Settings dialog, leave all values as default and click OK.
  5. Press Cancel on the Add Actions? dialog.
  6. Click the Autostart group in the main configuration tree.
  7. Click on the Configuration menu and select Add Action... (Shift+Ctrl+A).
  8. Under the group Webserver > Websocket actions client-server, select Start client and press OK.
  9. On the Action Item Settings dialog, leave all values as default and click OK.
  10. Make sure that the Webserver: Start client: Server action is currently selected in the Configuration tree.
  11. Click on the Configuration menu and select Execute Item (F5).
  12. You should now be able to see the error in the Log.

Expected Behavior

Upon adding the Webserver plugin, adding the Webserver: Start client action, and executing said action, the plugin should connect to the WebSocket server without raising an error.

Additional Context

Add any other context about the problem here.

Plugin Version

EG 0.4.1.r1722

  • Webserver 3.10 NO ERROR, HAS EXPECTED BEHAVIOR!

EG 0.5.0-beta1 <= 0.5.0-beta4

  • Webserver 3.12

EG 0.5.0-beta1 <= 0.5.0-rc6

  • Webserver 3.13.3

EventGhost Version

The error output is copy-pasta from 0.5.0-beta1, but the error is present in all beta and rc versions of EG.

The Cause

Based on my extensive research, I believe the cause is due to an accidental switch from the websocket-client module to the websocket module. My basis of it being accidental is due to the fact that both modules have the same package name once they have been installed (websocket).

THE SOLUTION

Switch back to the websocket-client module.

I replaced the websocket module included in EG 0.5.0-rc6 with the latest version of websocket-client (0.56.0) and everything appears to behave as expected.

@dale3h dale3h added the bug label May 9, 2019
@kdschlosser
Copy link
Member

crazy question for ya...

Do you have python 2.7 installed? and if so do you happen to have the websocket module installed into that installation? (not websocket-client)

when EG starts up it looks for python installations matching the major.minor version of python that EG is using internally. If it locates one it will add the site-packages folder from that installation into the user path. I believe it adds it before the EG site-packages folder in terms of lookup order. That means that packages installed into a matching python installation will override the ones installed in EG.

@kdschlosser
Copy link
Member

I just looked at the source. You are indeed correct. I am wondering why this has not come up at all before this.

It is better to have the builder install the websocket client library at the time it compiles instead of having it be a static addition like it is.

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

No branches or pull requests

2 participants