Difference in python between Android and Windows
#1
This may be a stupid question, but:

This works on Windows:

td = (datetime.datetime.utcnow()- datetime.datetime(1970,1,1))
unow = td.total_seconds()

same code does NOT on Android - it throws the following error:
AttributeError: 'datetime.timedelta' object has no attribute 'total_seconds'.

Reading the python docs, total_seconds() is available in python 2.7 and above.
I had xbmc.python="2.1.0" when I first tested above, so I set xbmc.python="2.14.0" which according to the kodi docs is ok for Helix. It still works on Windows, but throws the same error on Android. I'm running 14.2 Helix when testing both Windows and Android.

So, I kinda have two questions:
1) Why doesn't this work on Android?
2) Why does this work on Windows when xbmc.python="2.1.0" is set?

Thanks

For those interested, ended up using this workaround:
unow = int((td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6)
Reply
#2
Because the actual python version on windows differs from android .
Windows is 2.7.x
Android 2.6.x


xbmc.python is our API version
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
(2015-04-13, 17:52)Martijn Wrote: Because the actual python version on windows differs from android .
Windows is 2.7.x
Android 2.6.x


xbmc.python is our API version

Thanks, that explains it. I totally misunderstood what xbmc.python was for.
Reply

Logout Mark Read Team Forum Stats Members Help
Difference in python between Android and Windows0