Skip to content

BF: Skip camera devices with no available formats.#7568

Merged
TEParsons merged 1 commit intopsychopy:releasefrom
aforren1:release
Mar 4, 2026
Merged

BF: Skip camera devices with no available formats.#7568
TEParsons merged 1 commit intopsychopy:releasefrom
aforren1:release

Conversation

@aforren1
Copy link
Copy Markdown
Contributor

@aforren1 aforren1 commented Mar 2, 2026

I have some virtual cameras (e.g. OBS) on my system that have no available formats, and this leads to e.g.:

>>> x = CameraDevice.getAvailableDevices()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...\psychopy\hardware\camera\__init__.py", line 614, in getAvailableDevices
    minFrameRate = max(28, min([cam.frameRate for cam in allCams]))
ValueError: min() arg is an empty sequence

As far as I can tell, this is the only place where non-emptiness is assumed?

Tested vs. 2026.1.1 on Windows 11. This lets the app device manager successfully list the built-in webcam.

I have some virtual cameras on my system that have no available formats,
and this leads to e.g.:

>>> x = CameraDevice.getAvailableDevices()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...\psychopy\hardware\camera\__init__.py", line 614, in getAvailableDevices
    minFrameRate = max(28, min([cam.frameRate for cam in allCams]))
ValueError: min() arg is an empty sequence

As far as I can tell, this is the only place where non-emptiness is assumed?
@TEParsons TEParsons merged commit 5f95b7a into psychopy:release Mar 4, 2026
2 of 3 checks passed
@mdcutone
Copy link
Copy Markdown
Member

mdcutone commented Mar 4, 2026

This indirectly fixed another bug that seemed unrelated that I couldn't track down. Thanks for your help @aforren1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants