Stop an Error Message

Hey guys,

I feel like this should be something pretty easy, but I’m not sure how to start.

In my situation, I’m using system.serial commands through an RS-485 converter to talk to 8 counters.

I’m using a system.serial.write to send a command, and system.serial.readLine to get information back from the device. It works awesome. :slight_smile:

But, I’m foreseeing a problem. If someone were to unplug one of the counters, it would send an error message every 4 seconds (the write/reads are a timer script to refresh values). The actual error message I would get is “Underlying input stream returned 0 bytes”. The guys running this system are going to have absolutely no idea what that means. :slight_smile:

Is there a way to stop an error message through scripting, and instead just write to a tag. The long and short of it is that I want to light up an “Error” label on the screen, rather than annoying popup error every 4 seconds with a message that makes no sense to the guys running the system

Any idea are appreciated! :slight_smile:


You could use Python’s try…except.

That’s perfect, I looked at the try-except but it didn’t seem like it would work with the first documentation I looked at. Yours was much better, thanks!