klattimer / LGWebOSRemote

Command line webOS remote for LGTVs
MIT License
490 stars 97 forks source link

[Errno 8] nodename nor servname provided, or not known #154

Open Shasoosh opened 5 months ago

Shasoosh commented 5 months ago

Hey,

I've installed the latest version using pipx and getting this: lgtv --name OLED42 --ssl swInfo

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.11/site-packages/LGTV/__init__.py", line 186, in main
    ws = LGTVRemote(name, **config[name], ssl=args.ssl)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Library/Application Support/pipx/venvs/lgtv/lib/python3.11/site-packages/LGTV/remote.py", line 52, in __init__
    self.__ip = socket.gethostbyname(self.__hostname)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Removing this code from remote.py fixes it for me (not sure if this is a good approach, though:

        if self.__hostname is not None:
            # Over ride IP address when we know the hostname
            self.__ip = socket.gethostbyname(self.__hostname)
klattimer commented 3 months ago

Could you dump your config.json?

jgenunez commented 1 month ago

I have the same issue. When I do sudo killall -HUP mDNSResponder, everything returns to normal.