Wintermute0110 / plugin.program.AEL.dev

Emulator frontend and app launcher for Kodi
GNU General Public License v2.0
105 stars 36 forks source link

Port to python3 / Kodi 19 #124

Closed wberrier closed 3 years ago

wberrier commented 4 years ago

I updated to fedora 32, which ships kodi version 18.6 that uses python3 by default.

Launching the advanced emulator launcher gives the following output:

2020-05-07 23:39:32.394 T:140193827325696   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'ModuleNotFoundError'>
                                            Error Contents: No module named 'urllib2'
                                            Traceback (most recent call last):
                                              File "/home/wberrier/.kodi/addons/plugin.program.advanced.emulator.launcher/addon.py", line 21, in <module>
                                                import resources.main as main
                                              File "/home/wberrier/.kodi/addons/plugin.program.advanced.emulator.launcher/resources/main.py", line 20, in <module>
                                                import re, urllib, urllib2, urlparse, socket, exceptions, hashlib, shlex
                                            ModuleNotFoundError: No module named 'urllib2'
                                            -->End of Python script error report<--
2020-05-07 23:39:32.419 T:140193802147584   ERROR: GetDirectory - Error getting plugin://plugin.program.advanced.emulator.launcher/?content_type=game
2020-05-07 23:39:32.419 T:140194322973120   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.program.advanced.emulator.launcher/?content_type=game) failed

For reference:

https://rpmfusion.org/CommonBugs

Apparently most plugins are expected to be compatible with python 2 and 3?

Wintermute0110 commented 4 years ago

Kodi Leia 18.6 uses Python 2, not Python 3, at least officially. I know some distributions, for example Ubuntu 20.04 LTS Focal Fossa do not ship Python 2 at all, so that means only Kodi Matrix 19 can be used. Maybe there are some workarounds to use Kodi 18.x with Python 3 but I can assure it is not officially supported and may cause trouble.

AEL and AML are quite Python 3 ready, I expect the conversion to take a few hours. Once Kodi Matrix reaches version RC1 (I have no idea when that may happen, honestly, it can take one month, it can take 6 months) I will release AEL/AML versions specifically for Python 3.

True, there are tools and packages to make Python code compatible with Python 2 and 3. Also, Kodi core developers have encouraged to make addons 2/3 compatible. However, both AEL/AML are special cases because they are huge, about 20k lines of code each, and I don't want to use such libraries that may decrease performance. Note that AEL/AML may have many things to improve codewise but I spent a great deal of time making sure the code is optimized for speed where it is needed.

wberrier commented 4 years ago

Thanks for the response. I will follow up with rpmfusion (who packages Kodi for fedora). I may have to downgrade fedora or build kodi myself with python2 support.

It looks like only add-ons in the official repository must support python 2/3 for 18.x:

After the release of Kodi 18 (Leia) only add-ons that are compatible with both Python 2 and 3 will be accepted to the official add-on repository. Also, Python 3-only add-ons will be accepted to the repositories for Kodi 19 (M*) and above. [1]

And as a sidenote, thanks for the excellent addon, my family and I have enjoyed it for years :)

  1. https://kodi.tv/article/kodi-v18-leia-rc1-new-hope
barolo commented 4 years ago

just to chime in, distros are quite fast to jump onto kodi 19, even though it's alpha1, due to the python2 dependency, mine own surprised me with such update

Wintermute0110 commented 4 years ago

@barolo Kodi started using Python 3 a little bit late, in my opinion it should have been used in Leia. I understand that core developers wanted to delay the transition because it is a major PITA, however necessary. Linux distributions want to get rid of Python 2 ASAP and Kodi currently is one of the major blockers.

Now I am porting AML to Python 3. I started with AML because the code is simpler than AEL. Actually, the transition 2 -> 3 is easy, what is taking more time is the changes in the Kodi Python API. After I finish with AML I will start with AEL. It is going to take some time, although I have more free time due to Covid I want to be honest with you... it is difficult to concentrate and code sometimes.

mechevarria commented 3 years ago

Just bumping this since Kodi 19 came out.

Wintermute0110 commented 3 years ago

Noted. I'm deciding what to do with AEL right now. Probably I will post and update soon in the Kodi forum.

Wintermute0110 commented 3 years ago

Done. Closing issue.