Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

RuntimeError: deque mutated during iteration #8

Closed
talfirevic opened this issue Sep 15, 2019 · 2 comments
Closed

RuntimeError: deque mutated during iteration #8

talfirevic opened this issue Sep 15, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@talfirevic
Copy link

talfirevic commented Sep 15, 2019

import d3dshot
import time

d = d3dshot.create(capture_output="numpy")
d.capture(region=(100,100,300,300), target_fps=30)
time.sleep(20)
d.stop()
d.frame_buffer_to_disk()

dumping frame buffer to disk always yields following error:
File "C:\ProgramData\Anaconda3\envs\testing_env\lib\site-packages\d3dshot\d3dshot.py", line 119, in frame_buffer_to_disk for i, frame in enumerate(self.frame_buffer): RuntimeError: deque mutated during iteration

@nbrochu nbrochu added the bug Something isn't working label May 28, 2020
@nbrochu
Copy link
Member

nbrochu commented May 28, 2020

image

Runs fine here on 3.8.3. It's hard to tell why you are getting this but going by the error message: d.stop() might not be done running or getting ignored. d.frame_buffer_to_disk() iterates over what's in the frame buffer to save the individual images but if it receives new data while it does that, Python is not going to like it.

I'll look into why that could be happening at all and to see if there is more reliable way to stop the capture. I could also just copy the frame buffer to a separate iterable only for the duration of the image saving on disk.

Thanks for reporting this.

@nbrochu
Copy link
Member

nbrochu commented May 28, 2020

This should be fixed/improved in 0.1.4

@nbrochu nbrochu closed this as completed May 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants