Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4615

Python • Issues with code from Raspberry Camera Guide 2nd edition

$
0
0
Hello,

I am attempting to run the following code on an RPiZ 2W loaded with a new image of RPI OS Bookworm Lite

the code is as follows:-

Code:

import timefrom picamera2 import Picamera2, Previewcam = Picamera2()preview_config = cam.create_preview_configuration()cam.configure(preview_config)cam.start_preview(Preview.QTGL)cam.start()time.sleep(5)cam.stop()cam.stop_preview()
When I run this I get the following error as captured in the screenshot below:-
Python code and error.png
The code is presented in the subject book on page 90 with an accompanying explanation

What should happen is another screen preview image is opened for 5 secs allowing you to briefly view the camera image being recorded

Can anyone help and point me in the correct direction to resolve, please?

Thanks
JohnW

Statistics: Posted by ejwjohn — Sat Dec 21, 2024 2:11 pm — Replies 7 — Views 97



Viewing all articles
Browse latest Browse all 4615

Trending Articles