Currently I am writing a script that will take a picture with a picam on my raspberry pi. But when I run my code it exits after I call the camera to take a picture. I have tried using
subprocess.Popen(['sudo', 'raspistill', '-w', '320', '-h', '240', '-hf', '-o', '/home/pi/Documents/Python/robot1/image0.jpg'])
as well as
os.system('sudo raspistill -w 320 -h 240 -o /home/pi/Documents/Python/robot1/image0.jpg')
and
camera = PiCamera()
camera.start_preview()
sleep(2)
camera.capture('/home/pi/Documents/Python/robot1/image01.jpg')
camera.stop_preview()
but whenever either of these lines are run, my script exits. Does anybody know how to fix this?