Quantcast
Viewing all articles
Browse latest Browse all 1241

Python • Camera _init_ sequence not complete

As a beginner with Pi4B running Bookworm and V3 camera module with Picamera2 and Python3 I am trying to piece together code to allow my Raspberry Pi camera to be useful remotely using Connect. I have code to run a live preview and buttons to start the preview and start the preview. I also have a button to start a video capture to save a few seconds of the live video. In my code my button to launch video capture to a file is:

Code:

def capture_video(self):                  try:                      self.timer.stop()                      self.camera.stop()                      time.sleep(2)                      picam2 = Picamera2()                      config = picam2.create_video_configuration()                      picam2.configure(config)                      picam2.start_and_record_video("my_video.mp4", duration = 10                   except Exception as e:                      print (f"An error occurred: {e}")                   finally:                      time.sleep(2)                      picam2.stop()
The above is included in a main class

Code:

  class CameraWindow(QMainWindow)
where QWidgets display buttons and such.

The error seems to be the camera in configured state trying acquire() requiring state available, followed by Camera _init_sequence not complete.

the capture video code by itself works in a new python file - but I need it to work with all of the other code for buttons and windows and such. Would anyone be so kind as to help me over this wall? I have tried to stop the self.camera initialized at the beginning of the class code so as to be able to use the picam2 found in the def capture_video code.

Statistics: Posted by RixPi — Wed Mar 12, 2025 6:37 pm



Viewing all articles
Browse latest Browse all 1241

Trending Articles