klattimer/LGWebOSRemote

ws4py changes have broken LGWebOSRemote

sslupsky opened this issue · 3 comments

There was a recent change (well, 3 years ago but after the 0.5.1 release) to the ws4py repo and now something appears to be broken when LGWebOSRemote is installed related to asyncio. Encountered these two errors during installation:

  self.initialize_options()
  File "build/bdist.macosx-10.9-x86_64/egg/ws4py/async_websocket.py", line 87
    asyncio.async(closeit())
            ^
SyntaxError: invalid syntax

  File "build/bdist.macosx-10.9-x86_64/egg/ws4py/server/tulipserver.py", line 43
    f = asyncio.async(self.handle_initial_handshake())
                ^
SyntaxError: invalid syntax

Specifically, it appears the "future" has arrived related to this commit #b03d29b

The egg included with the install does not include these "unreleased" compatibility changes. I believe you need to update the version of ws4py included with the install.

Updating to the newer version of ws4py causes an error with websocket.py:

stevenslupsky@barbie-en0 LGWebOSRemote % ~/bin/lgtv auth 10.0.xxx.xxx OLED48C3 --ssl
Please accept the pairing request on your LG TV
{"closing": {"code": 1000, "reason": ""}}
Exception in thread WebSocketClient:
Traceback (most recent call last):
  File "/Users/stevenslupsky/.local/share/mise/installs/python/3.8.18/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/Users/stevenslupsky/.local/share/mise/installs/python/3.8.18/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/stevenslupsky/.local/share/mise/installs/python/3.8.18/lib/python3.8/site-packages/ws4py/websocket.py", line 528, in run
    if not self.once():
  File "/Users/stevenslupsky/.local/share/mise/installs/python/3.8.18/lib/python3.8/site-packages/ws4py/websocket.py", line 410, in once
    if not self.process(self.buf[:requested]):
  File "/Users/stevenslupsky/.local/share/mise/installs/python/3.8.18/lib/python3.8/site-packages/ws4py/websocket.py", line 465, in process
    logger.debug("Closing message received (%d): %s" % (s.closing.code, s.closing.reason.decode() if isinstance(s.closing.reason, bytes) else s.closing.reason))
TypeError: isinstance() arg 2 must be a type or tuple of types
Wrote config file: /Users/stevenslupsky/.lgtv/config.json

Hi
It works if you make a python environment with python-env.