Plugin.video.netflix: object of type 'NoneType' has no len()

Created on 25 Aug 2019  路  25Comments  路  Source: CastagnaIT/plugin.video.netflix

I'm submitting a ...

  • [x] bug report
  • [ ] feature request
  • [ ] support request

General information

Cannot play any media

Addon version used

v0.15.1, but failing since v0.15.0

Description

When selecting a episode or a movie, this last one fail.

Steps to Reproduce

  1. [First Step] Browse to a media
  2. [Second Step] Select it

Expected behavior:

The episode or movie should play

Actual behavior:

None (just crash)

Installation

  • [x] I'm using this Netflix Repo
  • [ ] I'm using other Netflix Repo (Please specify which)
  • [ ] I'm using a different source (Please tell which)

Operating System

  • [ ] Linux (x86/x64)
  • [ ] OSX (x86/x64)
  • [ ] Windows (x86/x64)
  • [x] Linux (ARM)
  • [ ] Android

Additional informatin on the environment

LibreELEC (official): 9.0.2, kernel: Linux ARM 32-bit version 4.19.36
Raspberry PI firmware version: Mar 6 2019 14:47:17

Debug log

2019-08-25 13:26:45.256 T:1739563888   ERROR: [plugin.video.netflix (0)] Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/http_server.py", line 47, in do_GET
                                                data = self.server.msl_handler.load_manifest(int(params['id'][0]))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 41, in error_catching_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 109, in load_manifest
                                                manifest = self._load_manifest(viewable_id, g.get_esn())
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 195, in _load_manifest
                                                manifest_request_data, esn)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 244, in _chunked_request
                                                self._post(endpoint, self.request_builder.msl_request(request_data, esn)))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/request_builder.py", line 37, in msl_request
                                                return (json.dumps(self._signed_header(esn)) +
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/request_builder.py", line 57, in _signed_header
                                                esn)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/default_crypto.py", line 62, in encrypt
                                                cipher = AES.new(self.encryption_key, AES.MODE_CBC, init_vector)
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/AES.py", line 200, in new
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/__init__.py", line 55, in _create_cipher
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/_mode_cbc.py", line 234, in _create_cbc_cipher
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/AES.py", line 89, in _create_base_cipher
                                            TypeError: object of type 'NoneType' has no len()
2019-08-25 13:26:45.258 T:1739563888   ERROR: Traceback (most recent call last):
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 654, in __init__
2019-08-25 13:26:45.260 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 713, in finish
2019-08-25 13:26:45.260 T:1739563888   ERROR:   File "/usr/lib/python2.7/socket.py", line 283, in close
2019-08-25 13:26:45.260 T:1739563888   ERROR:   File "/usr/lib/python2.7/socket.py", line 307, in flush
2019-08-25 13:26:45.260 T:1739563888   ERROR: error: [Errno 32] Broken pipe

Other information

I had to trunk the log as Elementum was extremely verbose. Let me know if you want me to drop the full one.

Bug

Most helpful comment

restarting the device should be solve

All 25 comments

restarting the device should be solve

Wow, I did reboot before posting the bug - without luck.

Now I just did it again to be sure and it worked!

Thank you very much!

Another user had same error on android:

I reinstalled the add-on and below is the logfile up to the point where the "background services started" banner came up
https://paste.kodi.tv/ihozohocis.kodi

I then restarted kodi and was able to login, when i tried to play a video I got an error, see below logfile
https://paste.kodi.tv/axetemoduj.kodi

Restarted kodi again and now all is working

there is need to investigate

I had the error once yesterday while trying OSMC, at first run (after the service started correctly).

It was just after Widevine install. After a reboot I couldn't reproduce the issue anymore.

For the last error, I think the service was dead. See line 1038 in https://paste.kodi.tv/axetemoduj.kodi

I don't know what the 'auto_update' value can be in settings.xml...

@acolombier can you provide your full debug logs please? You can use paste.ubuntu.com if it's very large.

summary for reference:
default_crypto line 76 i think "self.encryption_key" value
android_crypto line 97 don't know what parameter need to check "xbmcdrm.CryptoSession"

@Smeulf unfortunately, there is quite a few of sensible data in the log coming from other plugins. I tried to isolate the bit referring to Netflix plugin, hopefully that might be helpful ?

2019-08-25 13:23:54.544 T:1936613392   ERROR: Window Translator: Can't find window programssettings
2019-08-25 13:24:23.509 T:1146082160   ERROR: GetDirectory - Error getting plugin://plugin.video.netflix/
2019-08-25 13:24:23.513 T:1936613392   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.netflix/) failed
2019-08-25 13:24:26.811 T:1936613392   ERROR: Control 50 in window 10025 has been asked to focus, but it can't
2019-08-25 13:24:29.501 T:1146082160  NOTICE: script.module.youtube.dl: youtube_dl core version: 2018.11.07
2019-08-25 13:24:34.522 T:1146082160 WARNING: CPythonInvoker(21, /storage/.kodi/addons/script.extendedinfo/plugin.py): the python script "/storage/.kodi/addons/script.extendedinfo/plugin.py" has left several classes in memory that we couldn't clean up. The classes include: N9XBMCAddon7xbmcgui10DialogBusyE
2019-08-25 13:26:19.893 T:1495925616  NOTICE: DecodeJpeg: unable to decode https://occ-0-461-1167.1.nflxso.net/art/f0582/49c099f0119c08240367fa2b9b6b6c1f827f0582.jpg 1280x720
2019-08-25 13:26:20.414 T:1137689456  NOTICE: DecodeJpeg: unable to decode https://occ-0-461-1167.1.nflxso.net/art/b5ab7/6be7c7de49925a62ef3748d913d04f6db66b5ab7.jpg 1280x720
2019-08-25 13:26:23.785 T:1936613392  NOTICE: VideoPlayer::OpenFile: plugin://plugin.video.netflix/play/show/80044950/season/80103731/episode/80103819/
2019-08-25 13:26:23.787 T:1375724400  NOTICE: Creating InputStream
2019-08-25 13:26:23.893 T:1375724400   ERROR: GetDirectory - Error getting /usr/lib/kodi/addons/inputstream.adaptive/
2019-08-25 13:26:44.996 T:1375724400   ERROR: CCurlFile::FillBuffer - Failed: Timeout was reached(28)
2019-08-25 13:26:44.996 T:1375724400   ERROR: CCurlFile::Open failed with code 0 for http://localhost:44641/manifest?id=80103819:
2019-08-25 13:26:44.996 T:1375724400   ERROR: AddOnLog: InputStream Adaptive: Cannot download http://localhost:44641/manifest?id=80103819
2019-08-25 13:26:44.996 T:1375724400   ERROR: AddOnLog: InputStream Adaptive: Could not open / parse mpdURL (http://localhost:44641/manifest?id=80103819)
2019-08-25 13:26:44.999 T:1375724400   ERROR: CVideoPlayer::OpenInputStream - error opening [plugin://plugin.video.netflix/play/show/80044950/season/80103731/episode/80103819/]
2019-08-25 13:26:45.003 T:1375724400  NOTICE: CVideoPlayer::OnExit()
2019-08-25 13:26:45.218 T:1936613392  NOTICE: CVideoPlayer::CloseFile()
2019-08-25 13:26:45.218 T:1936613392  NOTICE: VideoPlayer: waiting for threads to exit
2019-08-25 13:26:45.218 T:1936613392  NOTICE: VideoPlayer: finished waiting
2019-08-25 13:26:45.256 T:1739563888   ERROR: [plugin.video.netflix (0)] Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/http_server.py", line 47, in do_GET
                                                data = self.server.msl_handler.load_manifest(int(params['id'][0]))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 41, in error_catching_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 109, in load_manifest
                                                manifest = self._load_manifest(viewable_id, g.get_esn())
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 195, in _load_manifest
                                                manifest_request_data, esn)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/msl_handler.py", line 244, in _chunked_request
                                                self._post(endpoint, self.request_builder.msl_request(request_data, esn)))
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/request_builder.py", line 37, in msl_request
                                                return (json.dumps(self._signed_header(esn)) +
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/misc_utils.py", line 246, in timing_wrapper
                                                return func(*args, **kwargs)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/request_builder.py", line 57, in _signed_header
                                                esn)
                                              File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/msl/default_crypto.py", line 62, in encrypt
                                                cipher = AES.new(self.encryption_key, AES.MODE_CBC, init_vector)
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/AES.py", line 200, in new
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/__init__.py", line 55, in _create_cipher
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/_mode_cbc.py", line 234, in _create_cbc_cipher
                                              File "/usr/lib/python2.7/site-packages/Crypto/Cipher/AES.py", line 89, in _create_base_cipher
                                            TypeError: object of type 'NoneType' has no len()
2019-08-25 13:26:45.258 T:1739563888   ERROR: Traceback (most recent call last):
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
2019-08-25 13:26:45.259 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 654, in __init__
2019-08-25 13:26:45.260 T:1739563888   ERROR:   File "/usr/lib/python2.7/SocketServer.py", line 713, in finish
2019-08-25 13:26:45.260 T:1739563888   ERROR:   File "/usr/lib/python2.7/socket.py", line 283, in close
2019-08-25 13:26:45.260 T:1739563888   ERROR:   File "/usr/lib/python2.7/socket.py", line 307, in flush
2019-08-25 13:26:45.260 T:1739563888   ERROR: error: [Errno 32] Broken pipe

Is there any precise info you were looking for ?

@acolombier I'm trying to determine if there's any previous error related to the service

I have exactly the same problem. The first time I was able to enter my profile and list, but playback did not work. I did a restart, and from that moment I can't even enter the list of movies or series
Logs - exactly the same as above. However, I noticed that after configuration I have nothing in the ESN field. It's empty.... in setings.xml also...
Log - restart with clear profile - login and error when try to play:
http://ix.io/1Tvi

Ok. I tried the git version - it works without a problem. I see that the settings have been heavily rebuilt ... I was on vacation - most things were moved to the database?

most things were moved to the database?

Indeed, and more changes/fixes. See https://github.com/CastagnaIT/plugin.video.netflix/commit/c269d3f0a1113255d0f40b1addd85bb94fe2ec0f

Not sure it's related, but I don't like this error : ERROR: [plugin.video.netflix (0)] SQLite error no such table: app_config :/

Another user had same error on android:

there is need to investigate

I have it on osmc, service mediacenter restart had solved the problem

I could reproduce it on Windows, at a very first run (deleted addon user data folder) https://paste.kodi.tv/azomacolar.kodi

"msl_data.json" is not created at first service run, generating a "ValueError: No JSON object could be decoded" (around line 576) (related to https://github.com/CastagnaIT/plugin.video.netflix/issues/173)

Then also at first service run, settings.xml is not created yet, and so we have an another error I should be able to fix
update_frequency = g.ADDON.getSettingInt('auto_update') TypeError: Invalid setting type

And finally, as msl_data.json is still not created, we have the encryption error (line 1765) when trying to play a video.

this is the cause of encryption error?

I think (will confirm) that as the username and password are not set yet, there's no handshake with the server, and then no encryption key.

In mslhandler:

if self.perform_key_handshake():
                self.request_builder = MSLRequestBuilder(json.loads(
                    common.load_file('msl_data.json')))

The service starts, without username/password.
No handshake done, no file msl_data.json created.
So encryption key is None (verified on debug), causing the error.

At logon, msl data should be reloaded IMo (but I did not look how to ^^).

Well, now I found the real problem:

  • the ESN is set at startup in the database
  • As there's no username/password, handshake can't be performed
  • When opening the addon, credentials are requested, and login is performed
  • Then we call update_session_data() (in nfssession.py), that will call _update_esn
  • Update ESN checks if the ESN has change, and if changed calls common.send_signal(signal=common.Signals.ESN_CHANGED, data=esn), that triggers perform_key_handshake in msl_handler.py

But the ESN didn't change, so signal is not sent, and handshake is not made, resulting in the error.
But, we need the ESN to be set or it will thrown an error at migration, that's why we made that commit "Simplified code for manual ESN"
https://github.com/CastagnaIT/plugin.video.netflix/commit/0be5d97cf9812803fd0fa346505b2ce3a4b65554

I have no idea how to fix it...

(rpi3 - OSMC) When install plugin i have same error of this issue...and after reboot "MSLError: Email or password is incorrect"
My debug log:
https://paste.kodi.tv/xubisonike.kodi

Well, now I found the real problem:

  • the ESN is set at startup in the database
  • As there's no username/password, handshake can't be performed
  • When opening the addon, credentials are requested, and login is performed
  • Then we call update_session_data() (in nfssession.py), that will call _update_esn
  • Update ESN checks if the ESN has change, and if changed calls common.send_signal(signal=common.Signals.ESN_CHANGED, data=esn), that triggers perform_key_handshake in msl_handler.py

But the ESN didn't change, so signal is not sent, and handshake is not made, resulting in the error.
But, we need the ESN to be set or it will thrown an error at migration, that's why we made that commit "Simplified code for manual ESN"
0be5d97

I have no idea how to fix it...

I'm studying a way, I also suspect that the database copy works but that the completion of the file copy is not waited by code causing the impossibility to check the tables and resulting start-up error
i'll let you know

Just found @Smeulf fix for the SQLite error on their github fork. Addon immediately started working again. I'll keep playing around with over the next couple days.

@snoopyjoe this is not THE fix, I mean it's fixing some problems, but not all related to this issue.

You can of course use the branch I'm working on, but remember I'm just helping @CastagnaIT the best I can, and he remains the main maintainer of this fork.

Temporary fix is better than broken in the developer world hahaha. I'm still following @castagnaIT git and repo for official things. Constant error messages even when not using the add-on was getting annoying.

The errors mentioned are solved in the new release

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dagwieers picture dagwieers  路  13Comments

notoco picture notoco  路  12Comments

kl3sk picture kl3sk  路  16Comments

pipsen picture pipsen  路  15Comments

dagwieers picture dagwieers  路  12Comments