is there a way to automatically restart your script when it gets stopped by an execution error? Something like REBOOT whenever the script stops at an error, of any kind?
The watchdog MOD.watchdog.Enable(xx) is fine if you get stuck at some logical error, waiting forever for some input etc, but I guess it is helpless in case a fatal error is encountered?
Thanks for your comments, Tom
Don’t know of such procedure, but what would be its purpose? Anyway the error must be treated before a clean new run can be started.
I agree that the sw should be free from bugs and errors. But in case there is for example an indexing error on a string, due to some input glitch, it would be handy to say within your code something like:"On Error do xxx".
In my case it would be enough to achieve reboot in case of an error, since I have a kind of a "mission critical" application and would not like to have it stopped altogether.
One way to do it is by hardware: add a watchdog circuit that forces the RESET pin to change state unless proper action takes place during a certain period of time.
But it would be useful have a similar functionality in the sw.
Well that’s a good usage and purpose of errors and exceptions handling, like in any other programming languages, don’t you think?
you could make a construction like this:
your current code
your current code
in that way python will reboot if an error occurs.
thank you, this feelss great, looks like a most simple way to do what I was thinking!
I will try it ASAP. Have you maybe some practical experience of this "trick" already?
we use it in all our applications and it works fine.
In a second step we have added a hardware watchdog too.
This helped us to save a lot of money in the last two years.
MDM2.send(‘AT#REBOOTr’ , 20)
sys.exitfunc = __exit()
Thanks for your interesting comment. But is the sys.exitfunc actually supported by the GE865 module? My primary reference, Telit_Easy_Script_Python_r13 does not seem to mention it.
I use GE863-GPS and also Telit_Easy_Script_Python_r13, so it should work for You.
Hit enter to search or ESC to close
Knowledge Base & Download Zone