0

I have recently purchased the Raspberry pi 5 and Raspberry pi AI camera as an absolute beginner. I have gone through all the demos in the terminal and it is working fine, but when I try to implamet it into my projects using Thonny, it doesn't seem to work. The camera preview never comes up and error messages pop up.

When I run this code:

from picamera2 import Picamera2

import time

# Initialize the camera
picam2 = Picamera2()

# Start preview (ensure the camera is available)
picam2.start_preview()
print("Camera preview started!")

# Allow some time for the preview to show up
time.sleep(5)

# Stop the preview after some time
picam2.stop_preview()
print("Preview stopped.")

This is the output:

Made X/EGL preview window
[1:12:28.402369763] [3916]  INFO Camera camera.cpp:1003 Pipeline handler in use by another process
ERROR: *** failed to acquire camera /base/axi/pcie@120000/rp1/i2c@80000/imx500@1a ***
New contributor
Tyler Russell is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • Check for syntax issues in your code. Also update the picamera2 library.
    – liaifat85
    Commented 2 days ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.