Proper way to exit script? sys.exit() crashes on OE
#1

Ok so there are times I want my addon to bail out (with a notification) - I have previously been in the habit of calling sys.exit() for this, but this is causing crashes on OpenElec.

What is the right way to bail out of an addon??
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#2
add breaks in loops and have a global variable on which you check if you need to bail out
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
i use this

Code:
xbmc.executebuiltin("XBMC.Container.Update(path,replace)")
xbmc.executebuiltin("XBMC.ActivateWindow(Home)")
Reply
#4
ok cool thanks - O think what I will do is jsut pass my internal exceptions back to the main program and then just flow out if I need to, after notifying the user (i.e. don't call exit(), just run off the end as it were...)

I don't know if per se I want it to drop back to home - what if it was started from the programs menu instead, for example?
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#5
Just make so that you flow through your code and skip everything that it "finishes"
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
#6
What I'd really like to do is use atexit() but apparently that's not possible as the interpreter is left running....it's because I really need to do some cleanup on the way out (I modify keymaps on the fly to get around various UI quirks etc - want to make sure no matter what I restore the system back to original state...)

Anyway, all good for now, thanks!
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply

Logout Mark Read Team Forum Stats Members Help
Proper way to exit script? sys.exit() crashes on OE0