The images are taken, I see the image file being created in the filesystem about 20 seconds before the program
Code: Select all
#!/usr/bin/python3 from picamera import PiCamera from time import sleep from fractions import Fraction from shutil import copyfile import datetime as dt camera = PiCamera( resolution=(1280,720), #resolution=(2592,1944), framerate=Fraction(1,6), sensor_mode=3) camera.rotation = 180 camera.shutter_speed = 6000000 camera.iso = 800 sleep(30) camera.exposure_mode = 'off' x = 1 while (1): string = dt.datetime.now().strftime('%Y-%m-%d_%H_%M_%S') fullstring = '/home/pi/nightlapse/images/image_%s.jpg' % string print('Starting capture ...') camera.capture(fullstring) print('Captured image %s' %fullstring) copyfile(fullstring, '/home/pi/nightlapse/webapp/static/image.jpg') sleep(60) x +=1
prints out Captured image .....
My problem is when I want to stop the program.
I use ^C and the program usually interrupts (not always!).
Often the system then becomes unresponsive and cannot be shutdown or connected to remotely.
All I can do at that stage is pull the power (which is abhorrant).
Is this the expected behaviour with the camera and PiCamera?
Have I made a mistake in my code.
I had no lockups before using a cron job to call a bash script that called raspistill every 5 minutes, but
was hoping to get more images as my exposure is 6 seconds.