klattimer / LGWebOSRemote

Command line webOS remote for LGTVs
MIT License
508 stars 98 forks source link

Any plans for Python3 code migration? #47

Closed cnekmp closed 5 years ago

cnekmp commented 5 years ago
[farid@unknown LGWebOSRemote]$ ./install.sh
Using base prefix '/usr'
New python executable in /home/farid/git/LGWebOSRemote/venv/bin/python
Installing setuptools, pip, wheel...
done.
Collecting wakeonlan==0.2.2 (from -r requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/26/87/4164f76446fb372ce9ff10f9458ac00dade098ef054772ab3333139e8cfa/wakeonlan-0.2.2.tar.gz
Collecting ws4py from git+https://github.com/Lawouach/WebSocket-for-Python.git#egg=ws4py (from -r requirements.txt (line 2))
  Cloning https://github.com/Lawouach/WebSocket-for-Python.git to /tmp/pip-install-hqw___dd/ws4py
  Running command git clone -q https://github.com/Lawouach/WebSocket-for-Python.git /tmp/pip-install-hqw___dd/ws4py
Building wheels for collected packages: wakeonlan, ws4py
  Building wheel for wakeonlan (setup.py) ... done
  Stored in directory: /home/farid/.cache/pip/wheels/25/52/13/d3cc3bb426cab70bc012874759d47a8d653488c29f3359a775
  Building wheel for ws4py (setup.py) ... done
  Stored in directory: /tmp/pip-ephem-wheel-cache-0gcmsbrb/wheels/f8/28/22/19457c71112349cdb67cb617b0687db6ee9ce532044314eeb6
Successfully built wakeonlan ws4py
Installing collected packages: wakeonlan, ws4py
Successfully installed wakeonlan-0.2.2 ws4py-0.5.1

**[farid@unknown LGWebOSRemote]$ python lgtv.py scan**
Traceback (most recent call last):
  File "/home/farid/git/LGWebOSRemote/LGTV/__init__.py", line 120, in LGTVScan
    response, address = sock.recvfrom(512)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lgtv.py", line 59, in <module>
    results = LGTVScan()
  File "/home/farid/git/LGWebOSRemote/LGTV/__init__.py", line 136, in LGTVScan
    print(e.message)
AttributeError: 'timeout' object has no attribute 'message'

[farid@unknown]$ python --version
Python 3.7.3

For those who has python3 by default installed on Linux (Manjaro, Arch) the solution is:

pacman -S python-virtualenv
pacman -S python2-setuptools
pacman -S python2-pip

Change install.sh line from: pip install -r requirements.txt to: pip2.7 install -r requirements.txt

Then run: sudo install.sh


[farid@unknown LGWebOSRemote]$ python2.7 lgtv.py scan
timed out
{
    "count": 1, 
    "list": [
        {
            "address": "192.168.1.111", 
            "model": "LF631V", 
            "uuid": "xxxx-xxxx-xxxx-xxxx"
        }
    ], 
    "result": "ok"
}
[farid@unknown LGWebOSRemote]$ 
klattimer commented 5 years ago

This should be done.