webcam (usb) access under Ubuntu

Laurent Pointal laurent.pointal at
Tue Apr 15 22:45:56 CEST 2008

Le Tue, 15 Apr 2008 05:21:54 -0700, Berco Beute a écrit :

> I've been trying to access my webcam using Python, but I failed
> miserably. The camera works fine under Ubuntu (using camora and skype),
> but I am unable to get WebCamSpy or libfg to access my webcam.
> First I tried webcamspy ( That
> requires pySerial and pyParallel, and optionally pyI2C. Runing WebCamSpy
> results in:
> Exception exceptions.AttributeError: "Parallel instance has no attribute
> '_fd'" in <bound method Parallel.__del__ of
> <parallel.parallelppdev.Parallel instance at 0x83326ac>> ignored
> This seems to come from importing I2C. The application window opens, but
> there's an error message:
> Next I tried libfg ( I built it, made the
> Python bindings and installed it. Unfortunately the following:
>>>>import fg
>>>>grabber = fg.Grabber()
> results in:
> fg_open(): open video device failed: No such file or directory
> Since the camera works fine in Ubuntu itself my guess is that the
> problem is with the python libraries (or even likelier, my usage of
> them). Is there anybody here that was successful in accessing their
> webcam on linux using Python? Else I have to reside to Windows and
> VideoCapture (which relies on the win32 api and thus is Windows-only),
> something I'd rather not do.
> Thanks for any help,

I dont know if this resolve your problem, but to get snapshots from a 
camera under linux, using V4L2 API, I wrote a small wrapper around this 
Its called pyvideograb, and its here:

Note: there is no automatic thing in this library, just a wrapper to 
V4L2, so you must know what options and image format your camera support 
and use these (you may have to convert image by yourself - see PIL and 
Numpy for quick data processing functions). To find the supported options 
you can use xawtv and give it ad-hoc cli option to make it verbose.



Laurent POINTAL - laurent.pointal at

More information about the Python-list mailing list