raspberrypi / picamera2

New libcamera based python library
BSD 2-Clause "Simplified" License
894 stars 189 forks source link

[OTHER] IndexError #1081

Closed mbauer575 closed 3 months ago

mbauer575 commented 3 months ago

Getting an IndexError when running picamera2 on rpi 5. I was able to run this program awhile ago but now im getting this error every time I run it.

    picam2 = Picamera2()
             ^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 246, in __init__
    camera_num = self.global_camera_info()[camera_num]['Num']
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
IndexError: list index out of range

Any ideas what could be wrong?

davidplowman commented 3 months ago

Maybe start by having a look at what Picamera2.global_camera_info() is returning. Perhaps your camera (or cameras) are not being detected for some reason?

mbauer575 commented 3 months ago

I reseated the camera cable and it seems to work fine now.