plugin.video.netflix icon indicating copy to clipboard operation
plugin.video.netflix copied to clipboard

Kodi - contexvars missing, 1.17 and 1.18 can't open on QNAP NAS

Open dadabear42 opened this issue 5 years ago • 20 comments

Bug report

Your Environment

  • Netflix add-on version: 1.18 (1.17)
  • Operating system version/name: QNAP QTC 5.0, Kodi 19.3 (19.1.)
  • Device model: QNAP TS-453B

Used Operating system:

  • [ ] Android
  • [ ] iOS
  • [X] Linux
  • [ ] OSX
  • [ ] Raspberry-Pi
  • [ ] Windows

Describe the bug

Version 1.17, 1.18 can't start, error "ContextVars" missing

Expected behavior

Netflix is started in the background and opened in latest addon version (1.18)

Actual behavior

Netflix doesn't open - error pops up - ContextVars missing. I could resolve with 1.16.2 which openes - only some library was missing (padding.py) which I manually added. I am able to open Netflix on downgraded version only.

Steps to reproduce the behavior

Instal newer version 1.17 or 1.18 and open

Possible fix

Update python version - I tried to follow different instruction found on web to update libraries via SSH. (Tried whatever I found targeting to Cryptodomex.

Debug log

The debug log can be found here: https://www.dropbox.com/s/ujt4o7mg06erufb/kodi.log?dl=0

Additional context or screenshots (if appropriate)

Other information

Some contextvars record can be found on this timestamp: 2021-11-06 11:35:58.377 T:5783 I tried to reinstal Python addons, HD station - no success

dadabear42 avatar Nov 06 '21 20:11 dadabear42

This is not an addon bug the addon require python 3.7 or higher then if you want run it on previous python versions you have to find some workarounds yourself

instead errors like this

only some library was missing (padding.py)

means that you have installed or was already installed other crypto library versions that lacking components

CastagnaIT avatar Nov 07 '21 09:11 CastagnaIT

interesting to know that you are trying to use kodi 19 on qnap it is the first time that i see this unfortunately i am not familiar with this system and the install instructions (for Kodi 18) in the Wiki was provided by other users

CastagnaIT avatar Nov 07 '21 09:11 CastagnaIT

interesting to know that you are trying to use kodi 19 on qnap it is the first time that i see this unfortunately i am not familiar with this system and the install instructions (for Kodi 18) in the Wiki was provided by other users

Hello Stefano, thank you for your feedback. I am not familier with this stuff at all therefore at the end I tried to check the situation here as I am observing different behaviou for above mentioed version.

QNAP has latest Python versions 3.5.2, 3.9.5 and 2.7.12 to be installed (different available packages) - I have installed all. I was assuming Netflix addin 1.16.2 --> working, 1.17, 1.18 not working --> same relevant changes in addon which might link to wrong area (searching for contextvars library).

Kodi 18 is no longer supported now and only available version is 19.3 (via qnapclub.eu repository). What I am able to understand and correct in version 1.16.2 was that libraries might be in different location where you addon is not searching in - I manually added padding.py (how was found here: asciidisco/plugin.video.netflix#665) I am not able to figure out contextvars issue - no instruction is available. I found there was some Python code change so some references might be different on QNAP. SSH python update didn't work either.

Nevertheless I am going to ask for support also on QNAP forum - I doubt I would be only user having this issue especially I made clean installation of HD station and Netflix addon.

dadabear42 avatar Nov 08 '21 19:11 dadabear42

QNAP has latest Python versions 3.5.2, 3.9.5 and 2.7.12 to be installed (different available packages) - I have installed all.

if you have installed multiple python enviroments (versions) i think is needed define the main version to be used with the Kodi enviroment, otherwise is possible that kodi still use the old 3.5.2 cause of "ContextVars" missing from your log the kodi debug is disabled then is not possible see nothing of useful but in any case i have no idea in how to help you to set the right python version as default

CastagnaIT avatar Nov 08 '21 19:11 CastagnaIT

I will try to remove obsolete/old versions and keep only the newest one. Here is reuploaded Kodi.log incl. debug info (thank you for this hint - you are right, much more clear even for analphabet like me. :-)) - LOG seems to be interesting from here: 2021-11-08 20:58:59.617 T:9932 (updated to 1.18 and started then reverted back to 1.16.2 and started) Edit: From here maybe better: 2021-11-08 20:59:25.579 T:24091, I will check also debug logging for Netflix addon if adds something into it (never checked that before)

I am now trying to read through as well.

dadabear42 avatar Nov 08 '21 20:11 dadabear42

So update - I tried to follow instruction here (old basically for python I think) and get the complete list of packages via terminal and tried to update all possible packages to python3 or even python3.8 depending on availability, ale remove python2.x packages - currently still without success - same error when starting 1.18. 1.16.2 works like a charm after downgrade (no impact from package changes).

But anyway - thank you very much for some valuable hints from your side. I was able to better understand packages differences a little bit and aim better to them.

Anyway I will try to move my focus to QNAP forum to ask for support there as well.

dadabear42 avatar Nov 08 '21 21:11 dadabear42

from your last log kodi still use the old python version /usr/lib/python3.6 it doesn't matter the version 1.16.2, old addon versions use old "libraries"

CastagnaIT avatar Nov 09 '21 07:11 CastagnaIT

Hi, thans a lot. .I figured it out somehow (installed in addition async_generator package) ==>I can start to login page. Either so I have some other error after login. I will try to search further. It could be I messed up some packages installation. Lets see. I might start from scratch one day.

ERROR <general>: [plugin.video.netflix (0)] Traceback (most recent call last):
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/database/db_base_sqlite.py", line 136, in _execute_query
                                                       cursor.execute(query, params)
                                                   sqlite3.OperationalError: no such table: profiles
                                                   
                                                   The above exception was the direct cause of the following exception:
                                                   
                                                   Traceback (most recent call last):
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/utils/website.py", line 136, in parse_profiles
                                                       G.LOCAL_DB.set_profile(guid, is_active, sort_order)
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/database/db_base_sqlite.py", line 50, in wrapper
                                                       return func(*args, **kwargs)
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/database/db_local.py", line 105, in set_profile
                                                       cur = self._execute_query(data[0], data[1])
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/database/db_base_sqlite.py", line 142, in _execute_query
                                                       raise DBSQLiteError from exc
                                                   resources.lib.common.exceptions.DBSQLiteError
                                                   
                                                   The above exception was the direct cause of the following exception:
                                                   
                                                   Traceback (most recent call last):
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/services/http_server.py", line 116, in handle_request
                                                       ret_data = _call_func(func, pickle.loads(data))
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/services/http_server.py", line 172, in _call_func
                                                       return func(**data)
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/utils/logging.py", line 139, in timing_wrapper
                                                       return func(*args, **kwargs)
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/services/nfsession/session/access.py", line 155, in login
                                                       website.extract_session_data(login_response, validate=True, update_profiles=True)
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/utils/logging.py", line 139, in timing_wrapper
                                                       return func(*args, **kwargs)
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/utils/website.py", line 82, in extract_session_data
                                                       parse_profiles(falcor_cache)
                                                     File "/opt/Kodi19L/.kodi/addons/plugin.video.netflix/resources/lib/utils/logging.py", line 139, in timing_wrapper

dadabear42 avatar Nov 10 '21 20:11 dadabear42

thanks very much for your support

installing unofficial packages to circumvent an error does not guarantee that the whole addon module is compatible with your old python version, but ofc you can try...

it is possible that the database has been corrupted by your attempts you should delete all files in addon user data, placed in kodi add-ons user data directory, here there are specified the directory path: https://kodi.wiki/view/Userdata

CastagnaIT avatar Nov 11 '21 07:11 CastagnaIT

Yes, thank you for getting me though line to this - this what I did afterwards and made it working (I found this hint in other thread you supported).

I will try to somehow clean up linux system from everything I tried to install and update. :-)

BTW you add on is actually onlyone I use on Kodi frequently - Netflix over chrome on NAS is useless - surroung audio topic. ;-)

dadabear42 avatar Nov 13 '21 08:11 dadabear42

Did you manage to fix that problem? I am trying to run the netflix addon on my QNAP (Kodi Matrix) as well but with no success

Guido83 avatar Jun 27 '22 15:06 Guido83

@Guido83 what python version has your qnap?

CastagnaIT avatar Jun 28 '22 06:06 CastagnaIT

I guess I was able to fix it by updating python

Guido83 avatar Jun 29 '22 07:06 Guido83

@Guido83 when you have time can you say to me if the wiki install guide for QNAP: https://github.com/CastagnaIT/plugin.video.netflix/wiki/How-install-the-addon

can go well also for Kodi 19 QNAP? or if it is needed some change in the wiki guide?

CastagnaIT avatar Jun 29 '22 08:06 CastagnaIT

Even though I have tried several things to fix the issue running netflix addon in Kodi 19 in my QNAP NAS, I am quite sure the main 'cure' was to install python3 from the QNAP Store here: https://www.qnap.com/de-de/app_center/?os=qts&version=5.0.1&type_choose=Developer%20Tools&II=214

And it has to be said that a NAS restart after installing python is cruicial, otherwise it still won't work.

What I also did was: apt install python3-pycryptodome

But I don't really know whether it is necessary

Guido83 avatar Jun 29 '22 08:06 Guido83

thank you i updated wiki

CastagnaIT avatar Jun 30 '22 06:06 CastagnaIT

I had same issue to install Netflix 1.19.1 add-on into Kodi 19.4.3 running on QNAP 5.0.1.2173 with HD Station 4.2.5

Here is what have to be done to have a fresh install:

  1. Install HD Station
  2. Install Kodi 19.4.3 from Qnapclub
  3. Run Kodi and go to settings -> file manager
  4. add new source https://castagnait.github.io/repository.castagnait/
  5. go to settings -> add-ons and install from zip file (repository.castagnait-2.0.0.zip) pointing the newly added source
  6. you will have to allow not official sources in the settings
  7. go to settings -> add-ons and install from repository pointing CastagnaIT Repository and install the plugin
  8. now if I lunch Netflix I will get contextvars error
  9. ssh with admin account to your box, goto shell
  10. find your data drive -> in my case /share/CE_CACHEDEV1_DATA/
  11. go to HD Station folder -> in my case /share/CE_CACHEDEV1_DATA/.qpkg/HD_Station
  12. chroot .
  13. sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
  14. apt install python3-pycryptodome - if you get error here close your AppCenter tab on the QNAP and wait a moment and try again
  15. pip3 install contextvars
  16. pip3 install async_generator
  17. pip3 install padding -> I believe this one should already be installed but just to doublecheck you can run it
  18. now go to QNAP panel and in HD Station click Restart button
  19. now if you lunch Netflix plugin you will get login screen

baniczar avatar Oct 13 '22 10:10 baniczar

Thank you - works for me (finally). I was not able to update to latest Netflix addon version (current 1.20.0) - before I stuck on 1.18.2 for very long time

What seems to be working for me out of the list above: 14. and 17. (other packages I had already installed / 13. can't be installed)

dadabear42 avatar Oct 29 '22 20:10 dadabear42

Fresh HD Station subsystem installation have both python 2.7 and 3.6 but 2.7 is default. Step #13 is telling to the HD Station subsystem to use 3.6 as default python command If you try to run this command 2 times it will give error the second time. So I believe you already ran this command in the past that's why you got error now. Fresh install should not give error until QNAP use 2.7 as default.

baniczar avatar Nov 02 '22 11:11 baniczar

if you install last python 3 version by using qnap store its not needed install contextvars/async_generator/padding workaround this addon support python 3.7 or above

CastagnaIT avatar Nov 02 '22 12:11 CastagnaIT