Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 support #35

Open
BUGBEAR7 opened this issue May 25, 2021 · 84 comments
Open

Python 3 support #35

BUGBEAR7 opened this issue May 25, 2021 · 84 comments

Comments

@BUGBEAR7
Copy link

Hello
I have been using this addon for last 1 year in my Kodi Krypton , but recently have to update the Kodi because few addon now does not support in old Kodi build.
Recently updated to Kodi Matrix as we all it does not support old python so I was wondering will there be any update for this addon

Thanks

@tkislan
Copy link
Contributor

tkislan commented May 25, 2021

Hello,
yes, I've done the compatibility update here: #34
But it didn't help the person who was asking for it
And my device doesn't yet have the update to new Kodi

Can you try the following version?
plugin.video.kodiconnect-0.3.0.zip

@BUGBEAR7
Copy link
Author

BUGBEAR7 commented May 25, 2021

Hello
I just tried to install it , it gave me same error for missing python 2.14.0
I edited the addon.xml to "import addon="xbmc.python" version="3.0.0"
It installed after that but after that got the error to check logs
putted the login details after that

Logs
2021-05-25 18:15:09.340 T:12260 INFO : [script.logviewer] "GET /favicon.ico HTTP/1.1" 200 -
2021-05-25 18:15:12.328 T:5308 INFO : [script.logviewer] "GET /tail?offset=76729 HTTP/1.1" 200 -
2021-05-25 18:15:18.081 T:12272 INFO : CActiveAESink::OpenSink - initialize sink
2021-05-25 18:15:18.990 T:6932 INFO : initializing python engine.
2021-05-25 18:15:19.101 T:6932 WARNING : xbmc.translatePath is deprecated and might be removed in future kodi versions. Please use xbmcvfs.translatePath instead.
2021-05-25 18:15:19.256 T:6932 ERROR : Skipped 1 duplicate messages..
2021-05-25 18:15:19.256 T:6932 ERROR : C:\Users\M-C\AppData\Roaming\Kodi\addons\plugin.video.kodiconnect\resources\lib\fuzzywuzzy\fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')

2021-05-25 18:15:19.307 T:6932 ERROR : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'TypeError'>
Error Contents: argument 1 must be str, not bytes
Traceback (most recent call last):
File "C:\Users\M-C\AppData\Roaming\Kodi\addons\plugin.video.kodiconnect\service.py", line 32, in
logger.debug(u'RESOURCES_PATHs: {}, {}'.format(RESOURCES_PATH, LIB_RESOURCES_PATH))
File "C:\Users\M-C\AppData\Roaming\Kodi\addons\plugin.video.kodiconnect\resources\connect\logger.py", line 7, in debug
_log(message)
File "C:\Users\M-C\AppData\Roaming\Kodi\addons\plugin.video.kodiconnect\resources\connect\logger.py", line 4, in _log
xbmc.log(u'[KodiConnect] {}'.format(message).encode('utf-8'), level=xbmc.LOGDEBUG)
TypeError: argument 1 must be str, not bytes
-->End of Python script error report<--

@tkislan
Copy link
Contributor

tkislan commented May 25, 2021

Ah thank you .. this should be easy to fix .. will let you know when the new version is available

@BUGBEAR7
Copy link
Author

Thanks
Will be waiting of that :)

@BUGBEAR7
Copy link
Author

Hi mate
Any update on this ?

@tkislan
Copy link
Contributor

tkislan commented May 29, 2021

plugin.video.kodiconnect-0.3.1.zip

It should fix the above problem .. but there still might be other issues .. please let me know if you have some other error thrown

@BUGBEAR7
Copy link
Author

BUGBEAR7 commented May 29, 2021

Thanks for the response

I installed it on a fresh new Kodi installation.
It installed correctly , after that I putted my login details . A pop up appeared that it is connected
I checked it at https://kodiconnect.kislan.sk/devices . It showed that device is connected but command of playing anything is not working though Alexa did said "Playing xxxxx in Kodi" but playback did not start . After a minute a two I got another pop up saying "Kodi Connect Disconnected" . I confirm this on webpage the previously connected device was not connected anymore.

I have only one error now in the log related to this plugin.video.kodiconnect

2021-05-29 13:09:36.930 T:2568 INFO : CPythonInvoker(6, C:\Users\M-C\AppData\Roaming\Kodi\addons\plugin.video.kodiconnect\service.py): script successfully run
2021-05-29 13:09:37.051 T:2568 INFO : Python interpreter interrupted by user
2021-05-29 13:09:39.520 T:6608 INFO : initializing python engine.
2021-05-29 13:09:39.597 T:6608 INFO : CPythonInvoker(37, C:\Users\M-C\AppData\Roaming\Kodi\addons\script.embuary.helper\default.py): script successfully run
2021-05-29 13:09:39.691 T:6608 INFO : Python interpreter stopped
2021-05-29 13:09:43.774 T:4840 INFO : initializing python engine.
2021-05-29 13:09:43.886 T:4840 WARNING : xbmc.translatePath is deprecated and might be removed in future kodi versions. Please use xbmcvfs.translatePath instead.
2021-05-29 13:09:44.043 T:4840 ERROR : Skipped 1 duplicate messages..
2021-05-29 13:09:44.043 T:4840 ERROR : C:\Users\M-C\AppData\Roaming\Kodi\addons\plugin.video.kodiconnect\resources\lib\fuzzywuzzy\fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')

I restarted the Kodi at start pop up appears as usual "Kodi Connect Connected" but after few minute another pop up comes saying it is disconnected . Same goes on webpage at Kodi startup the Connected is "Yes" but as the pop up appears in Kodi it goes to "No"

@BUGBEAR7
Copy link
Author

I also tested the older version on my Kodi Leia which is installed on a Mac, it is working fine as expected so setup to the Skill is correct. I guess there is something to be done in addon

@BUGBEAR7
Copy link
Author

BUGBEAR7 commented Jun 2, 2021

Hello
Have you checked it ?

@tkislan
Copy link
Contributor

tkislan commented Jun 2, 2021

@BUGBEAR7
Yes, sorry for the late reply
I actually can't figure out what might be wrong only from the portion you provided
Would it be possible to try the same thing, and send the full kodi.log file?

@BUGBEAR7
Copy link
Author

BUGBEAR7 commented Jun 5, 2021

Sure , I will send it today

@flos06
Copy link

flos06 commented Jun 11, 2021

Any progress on this? Or do you still need a full log file tkislan? In which case I can try to provide one.

@flos06
Copy link

flos06 commented Jun 11, 2021

So I've attached a logfile.

At first it says connected and then I try to give a command to watch a movie. In this case the father. Alexa replies with getting the father from kodi. Nothing happens however. At this point it states that kodi connect is still connected.

Manually starting a movie and trying 'alexa, pause' doesn't do anything either.

A few minutes later however kodi connect is no longer connected and in the log file it says connection closed as seen here:

Log:
https://paste.ee/p/cH0g8

@flos06
Copy link

flos06 commented Jun 14, 2021

Not to rush you but have you found the time to take a look? I would really love to get this working as it seems great :)

@tkislan
Copy link
Contributor

tkislan commented Jun 14, 2021

Yes, thank you ... I did take a look at the logs, but nothing irregular there .. no error at all .. so that's why it's taking longer
I will probably need to install it locally, and try what might be the problem

@flos06
Copy link

flos06 commented Jun 15, 2021

Alright thanks for trying to figure it out

@Motisu
Copy link

Motisu commented Jun 15, 2021

Also waiting for a fix. This addon is the only reason that I an not upgrading to matrix.
Good luck!

@Marcagodbout
Copy link

Hello tkislan,

Any update on the status of the addon?

First off thank you for this addon I have been using it for a long time now and love it, unfortunately I needed to upgrade all my kodi instances to 19 as well and was extremely sad when I found out they changed the python and kodi-connect stopped working, so THANK YOU for this add-on and taking the time to create and update it. I am very pleased to see you are getting it ready for 19.

I tried the install the zip you linked early in this post. As the others stated it connects initially but after a minute it just disconnects with no error. I ran it with logging turned on but not a single error coming from kodi-connect.
It scans the library for a second or 2, than after 1 minute almost exactly it just closes:
"DEBUG : [KodiConnect] Connection closed "

But like I said not a single error. I am not sure if this helps, but again thank you for the work you have done on this addon and I can not wait until the day you get it working with 19.

@BUGBEAR7
Copy link
Author

Hello tkislan

Sorry to bother you agin but is there any update on this ?
I switched back to 18.9 just because of this addon . So that is why I was unable to give the Kodi 19 log. But I guess you got the log

We are waiting for this

Thanks

@tkislan
Copy link
Contributor

tkislan commented Jul 12, 2021

I apologise, that I've still haven't been able to get to this .. but I do have it in my TODO list, as I also plan to upgrade my device to Kodi 19 aswell

@flos06
Copy link

flos06 commented Aug 13, 2021

Have you upgraded your device yet?

@tkislan
Copy link
Contributor

tkislan commented Sep 15, 2021

plugin.video.kodiconnect-0.3.3.zip

Can you please try this version?

It is working on my Kodi box, but just want to confirm, that it works for others as well

@Motisu
Copy link

Motisu commented Sep 15, 2021 via email

@Motisu
Copy link

Motisu commented Sep 18, 2021

Major problem. I have 2 Kodi platforms, 1 is a kodi box running Coreelec and the second is an intel NUC running Libreelec. both are running Kodi Matrix and both are registered at the connect site. The new 3.3 version runs well on the Coreelec box, but I get an error the second that I start it on the Libreelec box. Can you please look into this?

@tkislan
Copy link
Contributor

tkislan commented Sep 18, 2021

@Motisu
Can you please share kodi debug log so that I can try to resolve the issue

@Motisu
Copy link

Motisu commented Sep 18, 2021

sure. here it is
kodi.log
.

@tkislan
Copy link
Contributor

tkislan commented Sep 19, 2021

@Motisu
Copy link

Motisu commented Sep 19, 2021

sorry,but it didnt work. I uninstalled the old version and installed the new one. same problem. Here is an upload of the relavant part of the log
kodi.log
:

@tkislan
Copy link
Contributor

tkislan commented Sep 20, 2021

@tkislan
Copy link
Contributor

tkislan commented Jan 6, 2022

@captainfearless
That is a very weird error .. it fails with certificate being expired, but when visiting the web page, certificate is valid until "Expires: Tuesday, 1 March 2022"

@captainfearless
Copy link

Yes i read that, but didn’t know what an SSL certificate was!

What’s my best plan of attack?, start from scratch?

@LuKePicci
Copy link

LuKePicci commented Jan 6, 2022 via email

@captainfearless
Copy link

So what should i do boys?, leave it installed and keep trying? I‘ve been waiting for the return of my number 1 add on, and now it’s back i can’t use it!

@tkislan
Copy link
Contributor

tkislan commented Jan 8, 2022

@captainfearless Sorry, but I actually don't know Windows platform that well, to be able to solve this issue
It seems like it has outdated certificates installed? Because I'm using Letsencrypt as SSL certificate provider, which is pretty standard

@captainfearless
Copy link

captainfearless commented Jan 8, 2022 via email

@LuKePicci
Copy link

LuKePicci commented Jan 8, 2022

@tkislan I think @captainfearless is not using Windows otherwise it's CA certs would have been updated. I guess it is using an old kodi box/distro (either Linux or Android) which has not been updated with new CA certs.

CA cert of Let's Encrypt is expired a few months ago, old boxes without the new CA would not connect anymore to Let's Encrypt HTTPS websites.

Once again I confirm this add-on now works fine on Windows (UWP Kodi version 19.3)

@captainfearless
Copy link

Hi, just to confirm, i am running kodi on a PC with Windows 10, i am just 1 update behind, which is installing now.

@captainfearless
Copy link

Log is the same after updating, also manually imported a new certificate earlier.

@captainfearless
Copy link

Over on the Kodi forums i received this explanation.

your target server https://138.68.100.216 is using a self-signed certificate, which is unknown to kodi.
You should use a proper DNS name and valid certificate.

I'm confused by all of this, all i did was install a new version of Kodi Connect on a previously working set up.

Is the target server my home PC? If so how can i ''use a proper DNS name and valid certificate''

@captainfearless
Copy link

Another great explanation, but i don’t know in laymans terms what to do!

@tkislan
Copy link
Contributor

tkislan commented Jan 11, 2022

@captainfearless The thing is, that the code is connecting to http://kodiconnect.kislan.sk .. and not through the IP address
So I guess the issue might be with the python package on the windows platform .. but it is unlikely, that you are the only windows user here

@captainfearless
Copy link

Well i updated my Python package which didn’t fix it. It’s one of those things where some random update will fix it, so i’ll keep reinstalling.

@LuKePicci
Copy link

LuKePicci commented Jan 12, 2022

your target server https://138.68.100.216 is using a self-signed certificate, which is unknown to kodi. You should use a proper DNS name and valid certificate.

I'm not sure they correctly troubleshot this. I mean. that IP is the correct IP address of kodi-connect services, but when you contact that IP with correct hostname it responds with a valid certificate and no error is givem.

It is correct for that IP to respond with such invalid self-signed cert when you reach it without using the kodi-connect hostname.

So, why your kodi is using https://IP and not https://kodiconnect.kislan.sk/ ? I'm under windows too and its working fine here so this is a bit strange at least. Maybe you could try from another windows box?

Otherwise, their troubleshooting is wrong and the issue is about the other proper let's encrypt cert as I previously guessed.

@captainfearless
Copy link

I do appreciate your interest Luke. I’m baffled, i wonder if there is a way of forcing it to connect to https://kodiconnect.kislan.sk/? I was also wondering if my VPN could be the cause?

@LuKePicci
Copy link

Ok, it is definitely worth to try without the VPN. Also if you link us the Kodi forum where you asked for help I would be interested in reading it.

@captainfearless
Copy link

https://forum.kodi.tv/showthread.php?tid=366429

I will try again without the VPN.

@captainfearless
Copy link

Still failed. Also when Kodi Connect is installed, Kodi hangs on exiting.

@LuKePicci
Copy link

I confirm the troubleshoot done on kodi forums is likely wrong. The ssl error clearly states the cert is expired which has nothing to do with self-signing. As additional proof of what I'm saying, that self-signed cert is not expired.

The user on kodi forum has been fooled by that misleading error message where the pure IP is shown.

Try visiting https://kodiconnect.kislan.sk/ from your PC, using different browsers and see if any of them gives you certificate errors. Make sure you have no expired certs in their respective cert stores. If none of them give errors and you have no expired CA certs installed, then Kodi (or the Python interpreter) is using its own CA store and there is no valid CA for letsencrypt in there.

Try using Kodi UWP (Windows Store) if you didn't so far.

@captainfearless
Copy link

Update! My PC died, so i had to reset it, and now KC is working perfectly.

@Motisu
Copy link

Motisu commented Jun 2, 2022

Hi Tkislan,
Anything new with this bug? can I hope for it to be closed or should I just give up? :(

@tkislan
Copy link
Contributor

tkislan commented Jun 3, 2022

@Motisu
I will revisit this .. but to be honest, it will most likely require a lot bigger rewrite to support all the different platforms
No idea why it has such different behaviours with different platforms and different Python versions ...

@Motisu
Copy link

Motisu commented Jun 5, 2022

Well, thanks for trying. I am managing without it now on my main box but it runs very well on my bedroom TV. I guess a 1/2 is better than none, and I wish you good luck in solving the bug. I'll still be waiting patiently. :-)

@ZedeN1
Copy link

ZedeN1 commented Jul 15, 2022

I get the same/very simmilar error as @Motisu on Kodi 19.4 running LibreELEC 10.0.2 on Rasberry Pi 4B. Log file: https://paste.kodi.tv/aqukugonov.kodi

LibreELEC:~ # python --version
Python 3.8.9

@karl500
Copy link

karl500 commented Oct 10, 2022

Hi @tkislan,

Firstly thank you for this great add-on and also for the time and effort you have put into this.
Unfortunately i'm still having some issues.
When i run the add-on it exits with an error that there is no event loop in thread where the connection to your site is started.
I also looked into it a little bit and there seems to be some kind of change in asyncio where the creation of event loops is not done automatically in threads anymore.

Anyway, if you can please look into it further, it would be much appreciated.

Here's a link to the issue i found: https://stackoverflow.com/questions/51038793/error-happen-python3-6-while-using-tornado-in-multi-threading

and also my debug log from kodi:
kodi.log

@MartinsVision
Copy link

Is this up and running yet ?? Great app by the way 👏

@hindsight2021
Copy link

hindsight2021 commented Oct 29, 2023

I had success asking GPT4 to fix the addon, give this a try ya’ll - it worked for me on Kodi v21 omega.

plugin.video.kodiconnect-0.3.6-fixed.zip

Update - once the skill was connected after I updated with my zip in kodi I have full control w/alexa again. I hope it works for you too.

Changelog for plugin.video.kodiconnect-0.3.6-fixed

Fixed

  • Python Compatibility: Updated the import statement in resources/lib/tornado/httputil.py to address compatibility issues with recent Python versions.
    • Replaced collections.MutableMapping with collections.abc.MutableMapping to fix the AttributeError: module 'collections' has no attribute 'MutableMapping' error.

Notes

  • A warning about the use of a slow pure-python SequenceMatcher from the fuzzywuzzy library still persists. It suggests installing python-Levenshtein to remove this warning. While this warning does not impact the functionality of the addon, it might affect performance. Depending on the use-case, it can be considered for future optimization.

Developer's Changelog for plugin.video.kodiconnect-0.3.6-fixed

Detailed Modifications:

  1. File: resources/lib/tornado/httputil.py
    • Change: Updated the import statement for compatibility with recent Python versions.
    • Original Line: class HTTPHeaders(collections.MutableMapping):
    • Modified Line: class HTTPHeaders(collections.abc.MutableMapping):

@MartinsVision
Copy link

I can now connect but no commands work from Alexa

@captainfearless
Copy link

Has anyone currently got this working?

@MartinsVision
Copy link

I haven't yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests