addon.py
def log(msg):
print('[test] %s' % msg)
data = {'key1':1, 'key': 2}
try:
assert 'key3' in data, 'no key'
except Exception as e:
log(str(e))
else:
log('ok')
finally:
log('end')
general output
plugin.video.test python2 addon.py
[test] no key
[test] end
➜ plugin.video.test python3 addon.py
[test] no key
[test] end
kodi output, test OSX and Android 32bit
00:49:58.893 T:123145376911360 DEBUG: [test] ok
00:49:58.893 T:123145376911360 DEBUG: [test] end
https://forum.kodi.tv/showthread.php?tid=291013&pid=2421968#pid2421968
We set PYTHONOPTIMIZE=1 when loading the interpreter on most platforms.