Kodi Community Forum
Solved Add-on works on Windows but not Android - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Solved Add-on works on Windows but not Android (/showthread.php?tid=239592)



Add-on works on Windows but not Android - jsergio123 - 2015-09-21

I'm working on an add-on and it doesn't run on Python 3 because the whole Unicode and byte strings issue but it also fails on Android. It works fine on Windows but when I try to run it on Android Kodi 15.2-RC2 it throws an exception.

Code:
Error Type: <type 'exceptions.SyntaxError'>
                                            Error Contents: ('invalid syntax', ('<string>', 2, 1, '\r\n'))

Can anyone point me in the right direction to solve this?

Thanks


RE: Add-on works on Windows but not Android - Roman_V_M - 2015-09-21

"There are no psychics" © The Mentalist. Please provide more info like your code examples and a full exception traceback from a Kodi log if you want to get real help.

But what I can tell now is that on different platforms Kodi uses different Python versions 2.6-2.7. In particular, Kodi for Android uses Python 2.6. so writing your addons you should go by the syntax and the standard library contents of Python 2.6.


RE: Add-on works on Windows but not Android - jsergio123 - 2015-09-21

I think it might have something to do with the EOL conversion. Every time I save the file and set it to UNIX and I re-open it it is still detected as DOS/Windows format.


RE: Add-on works on Windows but not Android - jsergio123 - 2015-09-22

So basically I am manually encoding and decoding a string. If I do

Code:
"\n".join(mybase64encodedstring.splitlines())

then the script runs fine. I guess the problem is with the program I am using to decode and encode.


RE: Add-on works on Windows but not Android - jsergio123 - 2015-09-22

Yes the problem was with program i was using for decoding and encoding. I wrote a small script to do it programmatically and everything is working fine now.