letmaik / pyvirtualcam

🎥 Send frames to a virtual camera from Python
GNU General Public License v2.0
452 stars 49 forks source link

v4l2loopback: report per-device errors when no device was chosen #62

Open letmaik opened 3 years ago

letmaik commented 3 years ago

Currently, if device=".." is not used with v4l2loopback then devices from 0 to 100 are tried in sequence and all per-device error messages are swallowed and replaced by a final error "No v4l2 loopback device found..." (there is one exception to this which is that permission errors are raised immediately and not swallowed, as they would appear with all devices). Thus, to diagnose problems, a specific device has to be chosen such that the actual error is returned in the exception. This is annoying and could be improved.

One problem with reporting all per-device errors is that nearly all of them will be "Device ... does not exist" which is not very interesting. Only other kinds of errors should be included in the final exception message to prevent a big wall of text. Alternatively, same error messages could be grouped together.