cmer / lg-tv-control-macos

Automatically wake/sleep and change the input of your LG TV when used as a monitor on macOS
123 stars 12 forks source link

Readme setup guide PIPX error #44

Closed slawek-wozniak closed 5 months ago

slawek-wozniak commented 6 months ago

I spent roughly two hours trying to figure out why I couldn't get this to work, in my case what happened is:

the setup guide tells you to:

So I had the SSL error where I can't send the request to the tv because:

~ % lgtv auth <ip> MyTV --ssl
Traceback (most recent call last):
  File "/Users/user/.local/bin/lgtv", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/user/Library/Application Support/pipx/venvs/lgtv/lib/python3.12/site-packages/LGTV/__init__.py", line 137, in main
    ws.connect()
  File "/Users/user/Library/Application Support/pipx/venvs/lgtv/lib/python3.12/site-packages/ws4py/client/__init__.py", line 214, in connect
    self.sock = ssl.wrap_socket(self.sock, **self.ssl_options)
                ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

Chatgpt4 figured it out for me but it took a while. I ended up having to uninstall the lgtv package and unisntall pipx and install a tool that lets me switch between different pythons and I think I installed python three seperate times in total?

Btw please don't ready any of this in a negative tone, I had fun tinkering with making the tv a bit comfier to use as a monitor.

aximcore commented 5 months ago

Pipx is using a Python 3.12 version that is not compatible with the LGWebOSRemote package. To fix this, you need to remove the current package and then reinstall it with a Python 3.11 version. You can do this using the following commands:

pipx uninstall lgtv
pipx install git+https://github.com/klattimer/LGWebOSRemote.git --python python3.11
cmer commented 5 months ago

I have added an installation script to work around the different issues with newer Python versions. Please reinstall with the installation script. It might solve your issue.