Object of type 'NoneType' has no len()

usart error,run with modbus,when usart.any(), ide says --object of type ‘NoneType’ has no len().
and says my usart data is None repeatly .
that error happens in my modbus is first time,i never saw that before .what wrong with it?
my openmv is h7 plus

It means that something returned “None” and then the code tried to call .len() on that. So, it means there’s a bug in the if statements of the code as they are not checking if a function that returns something could return None.

thanks for your reply. i know your explain, i have no idea how that happens.
i run the modbus example of openmv, sometime ide says the index out of range,sometime ide says the none type has no len(). i want to know what trig that warning.
at this time ,i think i need the isr (interrupt service) ,but the isr of openmv is too weak. hope that will change a lot in the future .

Hi, that example is user submitted code. It’s not robust and or amazing. Our ISR support is fine. Just, example code is example code, you should expect to need to modify and fix it to work correctly. Sometimes example code is very robust, but, not always. For modbus, this is something I cannot even test and debug. So, I have no ability to make it reliable.

1 Like

roge that