How do I catch a select timeout error from Python try except
Hello everyone.
I'm working with a USB camera that sometimes fails with the infamous select timeout issue. I'm working on fixing that but for now I just want to manually shutdown and restart the camera port whenever this happens.
So here is my question: how can I catch a select timeout error? I'm thinking something along these lines:
cap = cv2.VideoCapture(0)
while(True):
try:
success, frame = cap.read()
except SelectTimeoutException:
restart_port()
...
The problem is that either OpenCV is not actually raising a Python error but rather printing directly or there is already a Try/Except block somewhere in the cv2 source catching the exception.
I'd appreciate any help.
it's unlikeley, that you can do anythng from python there (opencv is a c++ library, not a python one)
you did not show us the error msg, or your build information, but those errors are mostly coming from 3rd party / gstreamer libs, so don't expect pathon exceptions here.
No errors are coming out, just select timeout repeatedly printed to the console. Then my program attempts to run operations on the frame variable and erors out because there is no such frame. That's all.
Also, I'm using opencv-python 3.4.2.17