Skip to content

Program crashes with PiCameraRuntimeError "Timed out waiting for capture to end" #1

@DarthVi

Description

@DarthVi

Hi,
I've tinkered a little bit with your code in order to make it run fullscreen and I placed an instruction in /etc/xdg/lxsession/LXDE-pi/autostart to make it autostart when the LXDE starts. The rest of the code is pretty much the same original one.

However sometimes when I boot up the raspberry the code crashes and by redirecting stderr on a log file I found out this traceback:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1704, in capture_continuous
    'Timed out waiting for capture to end')
picamera.exc.PiCameraRuntimeError: Timed out waiting for capture to end

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mlx90640-library/thermal.py", line 45, in <module>
    for frame in camera.capture_continuous(rawCapture, format="rgb", use_video_port=True):
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1710, in capture_continuous
    encoder.close()
  File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 431, in close
    self.stop()
  File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 419, in stop
    self._close_output()
  File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 349, in _close_output
    mo.close_stream(output, opened)
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 371, in close_stream
    stream.flush()
  File "/usr/lib/python3/dist-packages/picamera/array.py", line 238, in flush
    self.array = bytes_to_rgb(self.getvalue(), self.size or self.camera.resolution)
  File "/usr/lib/python3/dist-packages/picamera/array.py", line 127, in bytes_to_rgb
    'Incorrect buffer length for resolution %dx%d' % (width, height))
picamera.exc.PiCameraValueError: Incorrect buffer length for resolution 288x368

I'm not expert on the picamera and the odd thing is that other times it works perfectly. If there was an error for the buffer length for resolution, shouldn't the code always fail instantly?
Is there a way to fix this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions