I am currently writing a wrapper class for OpenCVs implementation of capturing images with a webcam. I want to catch the error exception when the space on disk is full. The code for it would look like the following:
cap = cv2.VideoCapture(cam_idx)
ret, frame = cap.retrieve()
try:
cv2.imwrite('test.png',frame)
except IOError:
print("ERROR ON WRITING")
While this will catch the exception, I was wondering if this will also catch other Exceptions and how to only catch the exception for disk full, and what would be the best practice for making a test for this code snippet (besides filling up my disk with so much stuff that the hard drive is really full)
Aucun commentaire:
Enregistrer un commentaire