klattimer / LGWebOSRemote

Command line webOS remote for LGTVs
MIT License
521 stars 100 forks source link

Error when try to run inside docker #73

Closed caue-santos closed 3 years ago

caue-santos commented 3 years ago

When a try run a command, is returned this errors:

Traceback (most recent call last):
  File "/lgtv-venv/bin/lgtv", line 11, in <module>
    load_entry_point('LGTV==0.2', 'console_scripts', 'lgtv')()
  File "/lgtv-venv/lib/python3.8/site-packages/LGTV/__init__.py", line 137, in main
    ws = LGTVAuth(name, host)
  File "/lgtv-venv/lib/python3.8/site-packages/LGTV/auth.py", line 28, in __init__
    self.__macAddress = self.__get_mac_address(self.__ip)
  File "/lgtv-venv/lib/python3.8/site-packages/LGTV/auth.py", line 51, in __get_mac_address
    pid = subprocess.Popen(["ip", "n", "s", address], stdout=subprocess.PIPE)
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ip'

(lgtv-venv) root@b023e94a49b2:/lgtv-venv# cat /etc/*release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS" NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.2 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal

DarkCeptor44 commented 3 years ago

Just to make sure, what is the exact command you're trying to do for auth?

klattimer commented 3 years ago

docker isn't relevant, your network and installed packages are. closing.

caue-santos commented 3 years ago

@DarkCeptor44 this command with this result:

(lgtv-venv) root@ce6c77638830:/# lgtv auth 192.168.0.37 LG-TV
Traceback (most recent call last):
  File "/lgtv-venv/bin/lgtv", line 11, in <module>
    load_entry_point('LGTV==0.2', 'console_scripts', 'lgtv')()
  File "/lgtv-venv/lib/python3.8/site-packages/LGTV/__init__.py", line 137, in main
    ws = LGTVAuth(name, host)
  File "/lgtv-venv/lib/python3.8/site-packages/LGTV/auth.py", line 28, in __init__
    self.__macAddress = self.__get_mac_address(self.__ip)
  File "/lgtv-venv/lib/python3.8/site-packages/LGTV/auth.py", line 51, in __get_mac_address
    pid = subprocess.Popen(["ip", "n", "s", address], stdout=subprocess.PIPE)
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ip'

i created another container e reinstall all packages, but still with error

tmarly commented 3 years ago

To be able to scan your environment (ssdp), the container must be on the same network as the host, so use the option --network=host:

docker run --rm -it --network=host <container> <command>