简体   繁体   中英

Could not open camera using gphoto2 in python

I try to control a Sony Alpha using Python/gphoto2 on a Raspberry PI. I've tried a number of python bindings (python-gphoto2, gphoto2-cffi, ...) but they all fail at the instruction to create a camera object (eg. my_cam = gphoto.Camera()) with the error:

"Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device."

We tried to kill background programs, make sure the kernel modules are not running, install the latest versions of the libraries and python packages, ... but could not get rid of the error. Furthermore C code using libgphoto2 works fine so it's not likely that the resource is really busy. We suspect the problem is missing USB libs in the python packages, and have tried to install libusb-dev, ... but it doesn't help.

Any suggestions what else we should try? Thanks.

You mentioned trying python-gphoto2. I'm the author of that package. Assuming you have installed it successfully then I'd try the list-cameras.py example program. It should list any cameras recognised by libgphoto2 that are connected and switched on.

If C programs are working but Python ones aren't you could check that they're using the same versions of libgphoto2. Try ldd on the C program's executable and on one of the python-gphoto2 compiled modules, eg /usr/local/lib/python3.5/dist-packages/gphoto2/_camera.cpython-35m-arm-linux-gnueabihf.so .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM