JeffLIrion / homeassistant_native_firetv

43 stars 16 forks source link

cannot import name 'KEYS' #25

Closed JeffLIrion closed 5 years ago

JeffLIrion commented 5 years ago

https://community.home-assistant.io/t/native-support-for-fire-tv/64448/248?u=jefflirion

Just tried the lastest master firetv.py and get the following error.

Error loading custom_components.media_player.firetv. Make sure all dependencies are installed

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 117, in _load_file module = importlib.import_module(path) File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/config/custom_components/media_player/firetv.py", line 162, in <module> class FireTVDevice(MediaPlayerDevice): File "/config/custom_components/media_player/firetv.py", line 165, in FireTVDevice from firetv import KEYS ImportError: cannot import name 'KEYS'
JeffLIrion commented 5 years ago

Problem

You have an old version of the firetv package installed.

Solution

Case 1

If you already have firetv version 1.0.8 installed in your <configuration>/deps/lib/python3.6/site-packages folder, you can probably upgrade it to the latest version by running these commands:

# use the correct path for your setup
cd /config/deps/lib/python3.6/site-packages/firetv
mv __init__.py BACKUP.py
wget https://raw.githubusercontent.com/happyleavesaoc/python-firetv/master/firetv/__init__.py

Case 2

If you don’t already have firetv 1.0.8 installed, or if you deleted it, then hopefully HA will install it for you.

Case 3

If HA doesn't install firetv 1.0.8 for you, you can install it into a local folder on a different machine and then copy the folders over (e.g., using the Samba addon). To install firetv into the current folder, use the command:

pip install --target . https://github.com/happyleavesaoc/python-firetv/zipball/master
Fma965 commented 5 years ago

this doesn't actually fix the issue.

Fma965 commented 5 years ago
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 117, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/media_player/firetv.py", line 174, in <module>
    class FireTVDevice(MediaPlayerDevice):
  File "/config/custom_components/media_player/firetv.py", line 177, in FireTVDevice
    from firetv import KEYS
ImportError: cannot import name 'KEYS'

i don't have any firetv folders in deps

JeffLIrion commented 5 years ago

@Fma965 You need to look in the subfolders.

core-ssh:~# cd /config/deps/lib/python3.6/site-packages/
core-ssh:/config/deps/lib/python3.6/site-packages# ls
__pycache__                                         firetv-1.0.8.dist-info                              pyaes-1.6.1.dist-info
adb                                                 libusb1-1.6.6.dist-info                             pytuya
adb_homeassistant-1.3.1.dist-info                   libusb1.py                                          pytuya-7.0.dist-info
adb_messenger                                       pure_python_adb_homeassistant-0.1.6.dev0.dist-info  usb1
firetv                                              pyaes
Fma965 commented 5 years ago

I have, I still dont have any.

On Sun, 10 Feb 2019, 23:00 Jeff Irion, notifications@github.com wrote:

@Fma965 https://github.com/Fma965 You need to look in the subfolders.

core-ssh:~# cd /config/deps/lib/python3.6/site-packages/ core-ssh:/config/deps/lib/python3.6/site-packages# ls pycache firetv-1.0.8.dist-info pyaes-1.6.1.dist-info adb libusb1-1.6.6.dist-info pytuya adb_homeassistant-1.3.1.dist-info libusb1.py pytuya-7.0.dist-info adb_messenger pure_python_adb_homeassistant-0.1.6.dev0.dist-info usb1 firetv pyaes

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JeffLIrion/homeassistant_native_firetv/issues/25#issuecomment-462188525, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoNGjYDgNfDMPwO8Xvaxa7zzqqJIkAaks5vMKRxgaJpZM4as9Ra .

JeffLIrion commented 5 years ago

I posted some more detailed instructions above. It seems that HA version 0.87 doesn't install the dependencies for you, so you might need to install the firetv package yourself.

Fma965 commented 5 years ago

I dont believe I can do that on hass.io? Can I?

On Sun, 10 Feb 2019, 23:10 Jeff Irion, notifications@github.com wrote:

I posted some more detailed instructions above. It seems that HA version 0.87 doesn't install the dependencies for you, so you might need to install the firetv package yourself.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JeffLIrion/homeassistant_native_firetv/issues/25#issuecomment-462190185, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoNGhQuKFmsMMvLWttajJmh-xsN27u2ks5vMKbogaJpZM4as9Ra .

JeffLIrion commented 5 years ago

You have to do it on a different machine and copy the files over.

Fma965 commented 5 years ago

Yes, sorry, I missed that bit till after I replied. It's late here but will give it a try tomorrow and report back.

On Mon, 11 Feb 2019, 00:04 Jeff Irion, notifications@github.com wrote:

You have to do it on a different machine and copy the files over.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JeffLIrion/homeassistant_native_firetv/issues/25#issuecomment-462194382, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoNGsR820VBws6QIEiVOZeGI7n3ibdfks5vMLOWgaJpZM4as9Ra .

Fma965 commented 5 years ago

so i did the pip command now i have this? where does this go?

image

JeffLIrion commented 5 years ago

Copy and paste all of that to your <configuration>/deps/lib/python3.6/site-packages/ folder.

Fma965 commented 5 years ago

perfect thanks. its not complaining about that error now, haven't got it tested on a actual fire tv yet though.

EDIT: works, got some issues with it losing connection etc though but i haven't got time to sort that right now.