Posts: 3,571
Joined: Sep 2009
Reputation:
110
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*.
Posts: 17,859
Joined: Jul 2011
Reputation:
371
add breaks in loops and have a global variable on which you check if you need to bail out
Posts: 347
Joined: Nov 2011
2013-01-28, 18:03
(This post was last modified: 2013-01-28, 18:04 by mikey1234.)
i use this
Code:
xbmc.executebuiltin("XBMC.Container.Update(path,replace)")
xbmc.executebuiltin("XBMC.ActivateWindow(Home)")
Posts: 3,571
Joined: Sep 2009
Reputation:
110
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*.
Posts: 17,859
Joined: Jul 2011
Reputation:
371
Just make so that you flow through your code and skip everything that it "finishes"
Posts: 3,571
Joined: Sep 2009
Reputation:
110
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*.