CastagnaIT / plugin.video.netflix

InputStream based Netflix plugin for Kodi
MIT License
1.91k stars 259 forks source link

Playback error: module 'time' has no attribute 'time_ns' #1606

Closed mr-who2012 closed 1 year ago

mr-who2012 commented 1 year ago

Netflix add-on version

1.22.1+matrix.1

Operative systems used

Linux (Ubuntu / Mint / ...)

Kodi version used

Kodi 19 (Matrix)

Description of the bug

Netflix-Videos can't get played. A message-box appears, reading:

AttributeError: module 'time' has no attribute 'time_ns'.

Steps to reproduce the behavior

  1. Open Netflix-Addon
  2. Login-In
  3. Select Some Video and press Enter

Debug log - mandatory

https://paste.kodi.tv/raw/abonekolin

Possible fix

According to the stackoverflow-thread this should help:

For processor time use: time.process_time()

For wall-clock time use: Use time.perf_counter()

Alternatively: time.time() also measures wall-clock time but can be reset, so you could go back in time time.monotonic() cannot be reset (monotonic = only goes forward) but has lower precision than time.perf_counter()

Additional context

According to this thread, the python-function time_ns was removed in python 3.8 because it caused different behavior on different systems:

Obviously the change wasn't reflected in the netflix-addon.

Screenshots

No response

CastagnaIT commented 1 year ago

you are in wrong track, time_ns its new feature of python 3.7 and from your python path say that you are using python version 3.6

as installation page info, this addon require at least pyhton 3.7, so suggest you to upgrade your system

mr-who2012 commented 1 year ago

You are right! I'm so surprised. The posted thread refers to the command time.clock. It seems python-developers somehow have trouble with timing-functions, since they changed it again. Updating Ubuntu...because of netflix-plugin?! Naah! Not really. Hope to find python 3.8 for Ubuntu Bionic...or maybe a change in netflix-plugin-code for better compatibility with all systems. ;-) Just kidding. I don't expect that...

mr-who2012 commented 1 year ago

Just want to report back: There IS python 3.8 for ubuntu bionic. Here is how to install. After installation however, I had to manually set-up ubuntu to use the new python prior to the old one:

ls /usr/bin/python*

...gives you the install-directories for all installed python-versions.

update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2 
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 3 
update-alternatives --install /usr/bin/python python /usr/bin/python2 4 

...will add these directories to the program updates-alternatives. The syntax is:

update-alternatives --install <link-to> <Name in menu> <path-to-python-version> <menu-number>

afterwards, I ran

update-alternatives --config python

...and could choose which python-version to use for the whole system. So now, netflix will automatically use python 3.8, instead of some older installed python-version.

I found the neccesary steps described here.

mr-who2012 commented 1 year ago

...the error persists. There was even python 3.9, installed by ubuntu. I chose it with

updates-alternatives --config python

...and rebooted the system. It doesn't matter: netflix-addon still states:

"AttributeError: module 'time has no attribute time_ns".

CastagnaIT commented 1 year ago

and could choose which python-version to use for the whole system. So now, netflix will automatically use python 3.8, instead of

if really your "alternative" configuration is set correctly, python --version should show the current py version and on kodi log should appear the path of the new python version

mr-who2012 commented 1 year ago
#python --version

Python 3.9.13

Regarding to the kodi-log: I'm not sure if I can find the python-version used. There is a line:

2023-08-23 21:24:15.366 T:1830 INFO <general>: CAddonMgr::FindAddons: xbmc.python v3.0.0 installed ...but it seems to refer to an ADDON, not to python itself. Can't find any other version-numbers regarding to Python.

Meanwhile, I am getting new trouble now: I can't start the netflix-addon anymore. The error-message in kodi reads: "future feature annotations is not defined "

The logfile reads this:

netflix-error-pt1

...and this

netflix-error-pt2

I swear, I didn't change a thing. Since my last post here, I didn't switch-on the computer.

CastagnaIT commented 1 year ago

im sorry but i have little time and im not so skilled to help you to solve linux system problems