I have a python file that works standalone to take a photo, then post it to an api, but I want this file to be run when motion is detected on my livestream using
The file begins as it is supposed to, but when the time comes to take a photo, it stops working. I have not gotten an error report as it is not running in the terminal.
This is the chunk using the pygame module, where it stops working.
def Photo(): pygame.camera.init() cam = pygame.camera.Camera("/dev/video0",(1280,720)) cam.start() time.sleep(1.5) img = cam.get_image() global image_name image_name = 'image_' + date_time + '.jpg' pygame.image.save(img, image_name) Photo()
Any suggestions how I could get the pygame module working on top of motion would be appreciated, thanks!