I am trying to use OpenCV to video capture my webcam. Each time I run the program, python quits unexpectedly, and the code says [Finishd in 0.3s with exit code -6] Operating System - Catalina 10.15.3 Using sublime text 3 Python 3.8
import cv2
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()