ERPNext Didn't Support It?

The following code worked just fine on the system. However, on ERPNext it did not!
Why is that? Do I need to activate kind of integration?

    def validate(self):
        cap = cv2.VideoCapture(0)
        if not cap.isOpened():
            raise IOError('Cannot open camera. Check out the settings.')

        while True:
            ret, frame =
            frame = cv2.resize(frame, None, fx=1, fy=1,
            cv2.imshow('Smile!', frame)

            c = cv2.waitKey(1)
            if c == 32:  # ASCII Code for space

        cv2.imwrite('/home/omix/omar/c3.png', frame)

Seems opencv package. Is it?
You need to install the package on your environment and import it …

Yes I did, I did install the opencv using pip inside the virtual environment of frappe-bench and import it at the top of the code.

It worked after resetting the virtual machine, but now I get: Internal Server Error as a message