Opencv giving a C++ exception error form my python code

While making a barcode scanner I am facing the issue with opencv.

My code is:

import cv2
import numpy as np
import pyzbar.pyzbar as pyzbar


video = cv2.VideoCapture(1)


while True:
    cap, frame = video.read()
    rot = cv2.rotate(frame, cv2.ROTATE_180)

    decodedObjects = pyzbar.decode(rot)
    for obj in decodedObjects:
        print("Product", obj.data)
        

    cv2.imshow("Frame", rot)

    key = cv2.waitKey(1)
    if key == 27:
        break

video.release()
cv2.destroyAllWindows

This code works fine with my integrated webcam, but when I use the external webcam it gives me this error.

cap, frame = video.read()
cv2.error: Unknown C++ exception from OpenCV code

All kinds of support will be appreciated.

What information do you get when you capture the exception details? (as per this)