Execution error

10 thoughts on “Execution error

  1. Hi all,

     

    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

    1. 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.

      1. 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.

  2. Hello Tom,

     

    you could make a construction like this:

    try:

        your current code

    except:

        REBOOT

    in that way python will reboot if an error occurs.

  3. Michael,

     

    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?

     

    Tom

  4. Hello Tom,

     

    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.

  5. If You don’t want to worry about try and catch try this:
     

     

    import MDM2
    import  MOD
    import sys
     
    def __exit():
        MOD.watchdogDisable()
        MDM2.send(‘AT#REBOOTr’ , 20) 
     
    def init():
       sys.exitfunc = __exit() 

     

    1. Hi Lukasz

       

      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.

       

      BR, Tom