I am trying to catch timeouts of system.tag.writeBlocking() function (Ignition version 8.1.32).
For testing purposes, I have configured a tag change script on a tag that switches to 0 every 4 seconds.
The 300 you specify there seems to be 300ms, so if your write doesn't happen within that time, you'll get a timeout error. I'm not sure that this is the issue, but that's what I wanted to bring up after a quick glance at the docs.
Now-a-days, I recommend using java.lang.Throwable instead of java.lang.Exception, so that you don't have any name collision with python's Exception class, and to also catch Java Error instances.
Thank you for all your answers and for the insights, I did not know that except: clause alone did not catch Java errors.
Nevertheless, I have modified my script to use java.lang.Throwable and it still has not solved the issue...
Below is the updated script :
The Exception is being caught and logged, it's not re-thrown. There will be a QualityCode.Error_Exception at the corresponding index for the results of the call.
edit: actually all of the results will be Error_Exception in this case.
It seems the implementation is inconsistent between Client and Gateway scopes. Client scope wraps and re-throws via Py.JavaError(e).
Ok thank you very much for this explanation ! If I understood well, the code does not go into the except clause at all so I am not seeing those logs.
Is there a way I can remove this timeout log that appears on the gateway still ? I find it hard to troubleshoot, I prefer to implement custom logs describing which tags timed out following the method @pturmel mentioned.
Unfortunately the only thing you could do is turn that logger (Scripting[system_util_tag]) off entirely, which means you wouldn't see any log messages from it at all, perhaps hiding other issues.
Sorry one last question because I read too fast earlier on:
edit: actually all of the results will be Error_Exception in this case.
This means that even if the write to a single tag times out and the other writes are successful, QualityCode of Error_Expression will be returned for every write ?
Is there a way to know which write has timed out precisely ?
No, because the timeout isn't per tag, it's for the whole call. If it times out, the entire batch that was submitted got no results. We have no idea what writes were successful at that point.