Intermittent struct.error when reading the header from the frame buffer

Hello I am using the script to connect to the OpenMV camera using USB.

Some of the time it connects correctly, but other times it does not and instead produces the error

File "", line 66, in <module>
fb = pyopenmv.fb_dump()
File "/Users/kobi/CS/openmvcam/tools/", line 74, in fb_dump
size = fb_size()
File "/Users/kobi/CS/openmvcam/tools/", line 71, in fb_size
return struct.unpack("III",
struct.error: unpack requires a buffer of 12 bytes

It seems that the buffer does not have the necessary bytes set up yet, but I’m not sure how to make sure it does.

Any suggestions?

That scripts isn’t exactly the most error tolerant. The camera is just probably not in sync. That error is happening because the camera didn’t return the expected number of bytes at a time. What is the camera doing?