Quantcast
Viewing all articles
Browse latest Browse all 5402

Python • Re: Capture continous with counter start ftom x

Thanks for the reply
I get attributeerror:fornathack object has no attribute write
Could you please help?
The internal logic of the method capture_continous detects not a str via isinstance, which leads to assume the method, that it is a file. This is why the method tries to call write on the FormatHack instance.

This approach does not work and overwriting the __isinstancecheck__ with a metaclass is also not possible, because UserString is not a non-strict class.

A better way:

Code:

import timefrom itertools import countfrom picamera import PiCameraFRAMES_TO_CAPTURE = 60DELAY = 5counter = count(1337) # starts with 1337with PiCamera() as camera:    for frame_number in range(1, FRAMES_TO_CAPTURE + 1):        print("Frame number", frame_number)        count_value = next(counter)        filename = f"image_{count_value:04d}.jpg"         camera.capture(filename)        time.sleep(DELAY)

Statistics: Posted by DeaD_EyE — Tue Apr 16, 2024 9:27 am



Viewing all articles
Browse latest Browse all 5402

Trending Articles