I've been running my camera for nearly over a month now, with brief halting throughout the past month, but recently I noticed my picamera was not taking any pictures, I checked the script and it was failing at:
PiCameraValueError: Incorrect buffer length for resolution 128x80
Here is my
python 2.7 code:
testWidth = 128 testHeight = 80 def takeDayImage(imageWidth, imageHeight, filename): if verbose: print "takeDayImage - Working ....." with picamera.PiCamera() as camera: camera.resolution = (imageWidth, imageHeight) # camera.rotation = cameraRotate #Note use imageVFlip and imageHFlip variables if imagePreview: camera.start_preview() camera.vflip = imageVFlip camera.hflip = imageHFlip # Day Automatic Mode camera.exposure_mode = 'auto' camera.iso = dayISO camera.awb_mode = 'auto' camera.capture(filename) camera.led = True #False if verbose: print "takeDayImage - Captured %s" % (filename) camera.truncate(0) #added 07-30-17 return filename def motionDetection(): print "Scanning for Motion threshold=%i sensitivity=%i ......" % (threshold, sensitivity) print "Successfully loaded detectmotion.py" isDay = True currentCount= 1000 while True: if scanMotion(testWidth, testHeight, isDay): filename = getFileName(imagePath, imageNamePrefix, currentCount) if numberSequence: currentCount += 1 if isDay: takeDayImage( imageWidth, imageHeight, filename ) else: takeNightImage( imageWidth, imageHeight, filename )
I had read to call the
.truncate() method and have implemented it, after researching this exact error (as stated above), but it still seems to be having this same error.
Can someone please help?