Kodi Community Forum
platform.system() breaks scripts on iOS - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: iOS & tvOS (https://forum.kodi.tv/forumdisplay.php?fid=137)
+---- Thread: platform.system() breaks scripts on iOS (/showthread.php?tid=326535)



platform.system() breaks scripts on iOS - Skirmish - 2018-01-04

I've seen a few scripts that work on other platforms break on iOS because they use platform.system() eg line 439 here https://pastebin.com/3FNFUbab

I've read the iOS implementation of python doesn't allow spawning of child processes, which causes this error.


platform.system() breaks scripts on iOS - Memphiz - 2018-01-05

Yes that is correct as of tvos 10 and ios 11 iirc.


RE: platform.system() breaks scripts on iOS - Skirmish - 2018-01-05

I generated the error with iOS 10.2 (iPhone 6S, iPad Air 2), for some reason I'm not getting the error on tvOS 11.1 (ATV4 - non4k).

Seems like it might be a bug, or perhaps kodi for iOS isn't built for iOS >=10?


RE: platform.system() breaks scripts on iOS - Skirmish - 2018-01-07

I'm not certain this is a bug, although it seems to be a bug to me as it is limited to iOS >= 10 and not encountered in tvOS >= 10. Would anyone be able to advise and ill submit a bug tracker ticket if necessary?

Thanks in advance!


platform.system() breaks scripts on iOS - Memphiz - 2018-01-07

I have no idea what you mean - its forbidden in iOS and tvOS - that's a fact. What do you expect from kodi in that regard?


RE: platform.system() breaks scripts on iOS - Skirmish - 2018-01-07

That kodi not attempt to do so when calling platform.system() on iOS?

Sorry if that's an oversimplification of what's going on but the same script that runs fine without breaking on tvOS 11 breaks on iOS 10 when a call to platform.system() is made.

I assume that under tvOS 11 python isn't attempting to spawn any child processes when platform.system() is called but for some reason python does attempt to spawn child processes when platform.system() is called under iOS 10. Would that be correct?


platform.system() breaks scripts on iOS - Memphiz - 2018-01-07

No - calling system is forbidden - and it will always spawn a new process - that's how "system" call works - compiler for iOS and tvOS bails out when calling it from c/c++ too - that's why I had to remove all traces of those calls from kodi core for iOS and tvOS - are you sure that the code does what it should ob tvOS? Or is the system call somehow just "eaten" without doing the actual work?


RE: platform.system() breaks scripts on iOS - Skirmish - 2018-01-08

I'll grab a debug log when I get back to my tvOS box.

Until then all I can be certain of is that certain things load properly and behave as expected on tvOS that fail on iOS while calling platform.system() .

The end behaviour is very different from iOS to tvOS wether it's being eaten or handled properly which is why I considered it might be a bug.

Would there be a reason that something would load properly on tvOS while it will fail to load on iOS that wouldn't be a bug or unexpected behaviour?


platform.system() breaks scripts on iOS - Memphiz - 2018-01-08

The only thing that i can think of is that i have patched python for tvos in a stronger way then on ios. That might result in the fact that ios python throws an exception when „system“ is called and tvos silently ignores the call. If its anything else - then apple made the behavior inconsistent between tvos and ios.