def open()

in projects/vision-ai-edge-camera-client/edge_camera.py [0:0]


    def open(self):
        """Opens the source image as a connected camera."""
        if self.image:
            self.close()
        try:
            if self.printout:
                self.logger.debug("Opening image: {}".format(self.address))
            self.image = Image.open(self.address, mode="r")
        except FileNotFoundError as e1:
            if self.printout:
                print(f"Error: {e1!r}")
                self.logger.error("Cannot find image as camera")
            exit(1)
        except PIL.UnidentifiedImageError as e2:
            if self.printout:
                print(e2)
                self.logger.error("Cannot open image as camera")
            exit(1)
        except IOError as e3:
            if self.printout:
                print(e3)
                self.logger.error("Cannot open image as camera")
            exit(1)