Exception handling


Can I do anything more than print out an exception?  I am not getting a stack trace or anything useful to work with:

Below is my code

try:<br>    response = self._i2c.write_read(commandBytes, responseLength)<br>except Exception as e:<br>    print(e)<br>

And this is the output I get.  Exception @[0025:005E:0035:0039:0034:003D:0033:002D]

Not useful at all.  How do I decode this into a meaningful message?  I can't tell if this error is coming from my Atmel (flipnclick), Zerynth, or the click board (NFC Tag)


Hi martinleon,

usually, the exception raised in the console is preceded by its type/name (for example HardwareStatusError, etc.); by clicking the @[…] link in the device console you should receive more verbose error log messages in the Zerynth Studio console (the black one in the bottom of the Studio).

If you have to implement an I2C lib/script, you can follow this thread.
If you receive an HardwareStatusError during the write operation, most likely should be because of there is no one listening or responding in the I2C bus or because the address of the I2C component is not right.

Keep me posted :slight_smile:


I made some progress by using separate read and write calls but now I’m having another issue.

If I try to read more than 9 bytes from my click board, I get the below exception.  I am guessing it could be a timeout issue but the Zerynth I2C documentation doesn’t say what the default timeout value is and what units if I want to change the default timeout. 

TagClick: exception: InvalidHardwareStatusError  at line 104 of clickboards.readSystemFile
raised at line 154 of clickboards.readBinary
raised at line 207 of clickboards.sendAPDU
raised at line 127 of i2c.read

Please help


Hi martinleon,

the InvalidHardwareStatusError in our I2C library is raised when there are errors during I2C protocol data exchange and is not related to timing issues.

Can you post me please your code so I try to replicate this behavior and to better understand your problem?