Problem with "past.types" from "future" lib on Android and LibreELEC
#1
I adapt my addon for compatibility with 2/3 python using "future" lib. At the Windows addon works correct, but on Android (KODI 17.6) addon throw an exception:
Code:
20:01:12.431 T:548121456640  NOTICE: Starting Kodi (17.6 Git:20171119-ced5097). Platform: Android ARM 64-bit
20:01:12.431 T:548121456640  NOTICE: Using Release Kodi x64 build
20:01:12.431 T:548121456640  NOTICE: Kodi compiled Nov 19 2017 by GCC 4.9.0 for Android ARM 64-bit API level 21 (API level 21)
20:01:12.432 T:548121456640  NOTICE: Running on Meizu m2 with Android 5.1.0 API level 22, kernel: Linux ARM 64-bit version 3.10.65+
20:01:12.432 T:548121456640  NOTICE: Host CPU: AArch64 Processor rev 3 (aarch64), 4 cores available
20:01:12.435 T:548121456640  NOTICE: Local hostname: localhost
20:01:12.436 T:548121456640  NOTICE: -----------------------------------------------------------------------
20:01:16.107 T:547574775808   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Error Contents: (20, 'Not a directory', '/data/app/org.xbmc.kodi-1/base.apk/assets/python2.7/lib/python2.7/lib2to3/Grammar.txt')
                                            Traceback (most recent call last):
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/weather.gismeteo/default.py", line 14, in <module>
                                                from resources.lib.utilities import *
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/weather.gismeteo/resources/lib/utilities.py", line 7, in <module>
                                                from .simpleweather import Weather
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/weather.gismeteo/resources/lib/simpleweather.py", line 6, in <module>
                                                from past.types import basestring
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.future/libs/past/__init__.py", line 88, in <module>
                                                from past.translation import install_hooks as autotranslate
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.future/libs/past/translation/__init__.py", line 42, in <module>
                                                from lib2to3.refactor import RefactoringTool
                                              File "/home/jenkins/workspace/Android-ARM64/tools/depends/xbmc-depends/aarch64-linux-android-android-21/lib/python2.7/lib2to3/refactor.py", line 27, in <module>
                                              File "/home/jenkins/workspace/Android-ARM64/tools/depends/xbmc-depends/aarch64-linux-android-android-21/lib/python2.7/lib2to3/fixer_util.py", line 9, in <module>
                                              File "/home/jenkins/workspace/Android-ARM64/tools/depends/xbmc-depends/aarch64-linux-android-android-21/lib/python2.7/lib2to3/pygram.py", line 32, in <module>
                                              File "/home/jenkins/workspace/Android-ARM64/tools/depends/xbmc-depends/aarch64-linux-android-android-21/lib/python2.7/lib2to3/pgen2/driver.py", line 121, in load_grammar
                                              File "/home/jenkins/workspace/Android-ARM64/tools/depends/xbmc-depends/aarch64-linux-android-android-21/lib/python2.7/lib2to3/pgen2/pgen.py", line 385, in generate_grammar
                                              File "/home/jenkins/workspace/Android-ARM64/tools/depends/xbmc-depends/aarch64-linux-android-android-21/lib/python2.7/lib2to3/pgen2/pgen.py", line 15, in __init__
                                            IOError: (20, 'Not a directory', '/data/app/org.xbmc.kodi-1/base.apk/assets/python2.7/lib/python2.7/lib2to3/Grammar.txt')
                                            -->End of Python script error report<--
Is there any way to fix this problem?

Here is full log with enabled debugging: https://filebin.net/5d1zdt7ua1o0plgj/kodi.log
My addons: Gismeteo
Reply
#2
Another one bugreport from user: https://filebin.net/jm77tb214s28vzee/kodi.log
Code:
15:35:40 T:139625089034304 NOTICE: -----------------------------------------------------------------------
15:35:40 T:139625089034304 NOTICE: Starting Kodi (16.1 Git:c6f6e0b). Platform: Linux x86 64-bit
15:35:40 T:139625089034304 NOTICE: Using Release Kodi x64 build
15:35:40 T:139625089034304 NOTICE: Kodi compiled Oct 19 2016 by GCC 6.1.0 for Linux x86 64-bit version 4.4.13 (263181)
15:35:40 T:139625089034304 NOTICE: Running on AlexELEC (release) - Version: 7.1.2 (PC.x86_64), kernel: Linux x86 64-bit version 4.4.13 #1 SMP Wed Oct 19 08:53:05 EEST 2016 x86_64
15:35:40 T:139625089034304 NOTICE: Host CPU: Intel® Celeron® CPU 1037U @ 1.80GHz, 2 cores available
15:35:40 T:139625089034304 NOTICE: Local hostname: AlexELEC
15:35:40 T:139625089034304 NOTICE: -----------------------------------------------------------------------
16:35:44 T:139623647143680 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: No module named lib2to3.pgen2.parse
Traceback (most recent call last):
File "/storage/.kodi/addons/weather.gismeteo/default.py", line 14, in <module>
from resources.lib.utilities import *
File "/storage/.kodi/addons/weather.gismeteo/resources/lib/utilities.py", line 7, in <module>
from .simpleweather import Weather
File "/storage/.kodi/addons/weather.gismeteo/resources/lib/simpleweather.py", line 6, in <module>
from past.types import basestring
File "/storage/.kodi/addons/script.module.future/libs/past/__init__.py", line 88, in <module>
from past.translation import install_hooks as autotranslate
File "/storage/.kodi/addons/script.module.future/libs/past/translation/__init__.py", line 41, in <module>
from lib2to3.pgen2.parse import ParseError
ImportError: No module named lib2to3.pgen2.parse
-->End of Python script error report<--
My addons: Gismeteo
Reply
#3
And another one... full log: https://filebin.net/xfpmir1fwar8h6d8/01_KODI.log
Code:
05:00:12.582 T:4101525504  NOTICE: -----------------------------------------------------------------------
05:00:12.582 T:4101525504  NOTICE: Starting Kodi (17.5-RC1 Git:07424d3). Platform: Linux ARM (Thumb) 32-bit
05:00:12.582 T:4101525504  NOTICE: Using Release Kodi x32 build
05:00:12.582 T:4101525504  NOTICE: Kodi compiled Sep 14 2017 by GCC 6.2.0 for Linux ARM (Thumb) 32-bit version 3.14.29 (200221)
05:00:12.582 T:4101525504  NOTICE: Running on LibreELEC (community): 8.1.8 8.2, kernel: Linux ARM 64-bit version 3.14.29
05:00:12.585 T:4101525504  NOTICE: Host CPU: AArch64 Processor rev 4 (aarch64), 4 cores available
05:00:12.585 T:4101525504  NOTICE: Local hostname: s905x
05:00:12.590 T:4101525504  NOTICE: -----------------------------------------------------------------------
20:56:39.712 T:3713237920   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ImportError'>
                                            Error Contents: No module named lib2to3.pgen2.parse
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/weather.gismeteo/default.py", line 14, in <module>
                                                from resources.lib.utilities import *
                                              File "/storage/.kodi/addons/weather.gismeteo/resources/lib/utilities.py", line 7, in <module>
                                                from .simpleweather import Weather
                                              File "/storage/.kodi/addons/weather.gismeteo/resources/lib/simpleweather.py", line 6, in <module>
                                                from past.types import basestring
                                              File "/storage/.kodi/addons/script.module.future/libs/past/__init__.py", line 88, in <module>
                                                from past.translation import install_hooks as autotranslate
                                              File "/storage/.kodi/addons/script.module.future/libs/past/translation/__init__.py", line 41, in <module>
                                                from lib2to3.pgen2.parse import ParseError
                                            ImportError: No module named lib2to3.pgen2.parse
                                            -->End of Python script error report<--

My addons: Gismeteo
Reply
#4
@vl_maksime

Please try to provide log files via text upload websites like pastebin.com or paste.ubuntu.com (for the larger log files). It will unburden our forum database. Thanks in advance.

Also, your log files appear to be incomplete. Always enable debugging mode in Kodi, and provide the FULL unabbreviated kodi.log, and not those sections that you perhaps find interesting. Errors/bugs can start at any moment. Now there are 3 separate posts, and still there is no full log file AFAICT.
Reply
#5
@Klojum 
There was link on full log in second post. Updated the rest of the posts, added log files.
I provided part of the log with system information and part where my addon was crashed.
My addons: Gismeteo
Reply
#6
There are 2 independent issues here:
1) Python 2.7 on LibreElec is missing lib2to3 Standard Lib package competely.
2) Python on Android cannot read Grammar.txt file for some reason, although it is present there along with lib2to3 package.

For now I'd recommend not to use "past" package from script.module.future. If you need some features from there, use workarounds. For example:
python:
try:
    basestring
except NameError:
    basestring = str  #For Python 3
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with "past.types" from "future" lib on Android and LibreELEC0