tamland / kodi-plugin-routing

A routing module for kodi plugins
GNU General Public License v3.0
40 stars 12 forks source link

error after upgrade from v0.2.1 to v0.2.3 in kodi #27

Open Manyone1 opened 4 years ago

Manyone1 commented 4 years ago

the problem occurs when i use the addon missingmovies to find new movies on disk. it is only on folders with german characters like äÄöÖüÜß with v.0.2.1 ther are no problems but with v0.2.3 there comes up an error. I tried the 0.2.2 to, by manual installation, so i dont know if it is a reference, but the same error as in 0.2.3 comes up. error_missingmovies.txt

dagwieers commented 4 years ago

@mediaminister This one is up your alley :wink:

mediaminister commented 4 years ago

Most likely the arguments in argv are not decoded to unicode in the run function. Converting the incoming arguments to unicode should fix this problem:


for i, arg in enumerate(argv):
    argv[i] = to_unicode(arg)
dagwieers commented 4 years ago

@mediaminister I guess that the calling add-on is not using unicode_literals while this add-on now does.

~@Manyone1 I guess we need to discuss this with the missingmovies add-on author to discuss the best way forward. I expect this add-on not to be ready for Python 3 either.~

mediaminister commented 4 years ago

I guess that the calling add-on is not using unicode_literals while this add-on now does.

The problem with the routing add-on is that sys.argv doesn't support unicode strings in Python2, so this is always treated as ASCII. You have to decode the arguments that are passed through sys in Python2 to unicode.

dagwieers commented 4 years ago

But if you import unicode_literals from future, any string in Python2 is considered unicode.

I would be surprised if sys.argv would be excluded from being a unicode literal. But it appears you are right (again!). It appears a list of standard libraries do not use unicode literals by default :disappointed:

[dag@moria ~]$ python2 -c 'import sys; print type(sys.argv[1])' föobàr
<type 'str'>
[dag@moria ~]$ python2 -c 'from __future__ import unicode_literals; import sys; print type(sys.argv[1])' föobàr
<type 'str'>

I will make a PR for this.

dagwieers commented 4 years ago

@Manyone1 Can you try the following fix by installing this ZIP file: https://github.com/dagwieers/kodi-plugin-routing/archive/argv-unicode.zip

It should provide you with a working v0.2.3 release and should be a good workaround until an update is released. Please report back!

Manyone1 commented 4 years ago

doesnt work, back on 0.2.1

dagwieers commented 4 years ago

@Manyone1 Can you share a log when using this version? It may fail for another reason...

dagwieers commented 4 years ago

I can confirm with my tests that we did fix the unicode_literals problem with sys.argv that could lead to the errors you see.

Manyone1 commented 4 years ago

log.txt have it a little bit shorten