Encountering PIL trouble between Windows, Android, and Linux
#1
I created the SportsView addon (WIP). 

When i run it on my windows machine and / or Android (Nvidia Shield) it works fine. But when a user is trying to use it on a Linux machine they are getting this error:

error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-- - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS! Error Type: <class 'IndexError'> Error Contents: list index out of range Traceback (most recent call last): File "/home/alarm/.kodi/addons/plugin.sportsview/mysports/mysportswindow.py", line 44, in onAction self.sports_buttons.moveFocus(1, 0) File "/home/alarm/.kodi/addons/plugin.sportsview/mysports/mysportsbuttons.py", line 231, in moveFocus self.parent_window.setFocusId(self.buttons[self.focused_index].getId()) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ IndexError: list index out of range -->End of Python script error report<--

I realize textsize is apparently deprecated. However, when i attempt to use textlength I get this error:

2024-03-27 12:50:02.704 T:28592 error : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'AttributeError'>
Error Contents: 'ImageDraw' object has no attribute 'textlength'
Traceback (most recent call last):
File "C:\Users\mjc_c\AppData\Roaming\Kodi\addons\plugin.sportsview\mysports\mysportswindow.py", line 23, in onInit
self.sports_buttons.get_sports_folders()
File "C:\Users\mjc_c\AppData\Roaming\Kodi\addons\plugin.sportsview\mysports\mysportsbuttons.py", line 80, in get_sports_folders
self.check_button_cache()
File "C:\Users\mjc_c\AppData\Roaming\Kodi\addons\plugin.sportsview\mysports\mysportsbuttons.py", line 103, in check_button_cache
self.generate_custom_buttons(sport)
File "C:\Users\mjc_c\AppData\Roaming\Kodi\addons\plugin.sportsview\mysports\mysportsbuttons.py", line 128, in generate_custom_buttons
text_width, text_height = focused_draw.textlength(sport, font)
AttributeError: 'ImageDraw' object has no attribute 'textlength'
-->End of Python script error report<--

All machines have PIL 10.2 installed.
The addon.xml import line for pil is this :         <import addon="script.module.pil" version="1.1.7"/>


Feels like a damned if i do damned if i don't situation at the moment. I don't have Linux to test on but i don't think Linux is the issue here.

Appreciate any insights!! THanks!!
ZappBrannigan
Reply
#2
This is probably because Kodi comes with Pillow;  v5.10 in Kodi 21. Try installing Pillow on your linux host instead. I don't specify a version number in my addon.xml, that might be the problem as well.
Reply
#3
Just an FYI, that versioning is way off reality.

Windows has shipped with 6.2.1 for over 4 years. Android/apple has had 7.1.2 or newer since Matrix.

Linux has whatever your distribution provides
Reply
#4
what would your <import addon="script.module.pil" version="1.1.7"/> line look like? Or do I not need this line at all?
ZappBrannigan
Reply
#5
Sorry... You mean the version of PIL?

I just used "pip show Pillow" in console to determine the version.
ZappBrannigan
Reply

Logout Mark Read Team Forum Stats Members Help
Encountering PIL trouble between Windows, Android, and Linux0