New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3: TypeError: 'dict_values' object does not support indexing in camera.py #80

Closed
pmermoz opened this Issue Mar 29, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@pmermoz

pmermoz commented Mar 29, 2014

With the following code:

import picamera
with picamera.PiCamera() as camera:
camera.resolution = (1280, 720)
stream = picamera.PiCameraCircularIO(camera, seconds=10)
camera.start_recording(stream, format='h264')
camera.wait_recording(10)
camera.stop_recording()
exit(0)

I get the error:
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1470, in _get_frame
return self._encoders.values()[0].frame
TypeError: 'dict_values' object does not support indexing

I use python3 on raspberry.
get the problem with the raspbian and github, report for github source.

workaround:

in the file camera.py, replaced the line
return self._encoders.values()[0].frame
by
return list(self._encoders.values())[0].frame

Thanks for this API and outstanding documentation!
Pascal

@waveform80

This comment has been minimized.

Owner

waveform80 commented Mar 29, 2014

Damn - you're absolutely right; I forgot to run the test suite against Python 3 last release, and Python 3 changes dict.values to be a generator. Sorry about that - I'll try and get a fix out this weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment