jim-easterbrook / python-gphoto2

Python interface to libgphoto2
GNU Lesser General Public License v3.0
359 stars 59 forks source link

Error in capture-image for Canon 5D Mark IV #68

Closed francophongvu closed 5 years ago

francophongvu commented 5 years ago

I installed libgphoto2 on Pi, connect Canon camera and simply run the example: capture-image.py

I received the error:

WARNING: gphoto2: (gp_port_usb_close [libusb.c:325]) Invalid parameters: 'port && port->pl->dh' is NULL/FALSE. Capturing image Camera file path: //capt0000.jpg ('Copying image to', '/tmp/capt0000.jpg') Error: no "view" rule for type "image/jpeg" passed its test case (for more information, add "--debug=1" on the command line) /usr/bin/xdg-open: 771: /usr/bin/xdg-open: www-browser: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open: links2: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open: elinks: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open: links: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open: lynx: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open: w3m: not found xdg-open: no method available for opening '/tmp/capt0000.jpg' WARNING: gphoto2: (ptp_usb_getresp [usb.c:482]) PTP_OC 0x911c receiving resp failed: PTP Device Busy (0x2019) WARNING: gphoto2: (camera_unprepare_canon_eos_capture [config.c:557]) 'ptp_canon_eos_resetuilock (params)' failed: PTP Device Busy (0x2019) WARNING: gphoto2: (gp_port_usb_close [libusb.c:325]) Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.

Any suggestion is aprreciated

jim-easterbrook commented 5 years ago

Install an image viewer known to xdg-open, or remove the line subprocess.call(['xdg-open', target]) from your copy of the example script.

The remaining warning messages are normal and can be ignored.

francophongvu commented 5 years ago

Thanks for quick reply,

I tried to remove the line subprocess.call(['xdg-open', target]) then it seems no error, but there're no file saved in camera (ran command linegphoto2 --list-files)

There is no file in folder '/'.
There is no file in folder '/store_00010001'. There is no file in folder '/store_00010001/DCIM'. There is no file in folder '/store_00010001/DCIM/100EOS5D'. There is no file in folder '/store_00010001/MISC'.

Sorry, I am new with this library

jim-easterbrook commented 5 years ago

You camera is set to record to RAM, not to its memory card, which is why the file name is capt0000.jpg. Set the capture target to "memory card" and you should then capture files with names like DSCN1234.JPG.

francophongvu commented 5 years ago

Hi, just a stupid question: is it possible to set the capture target to "memory card" by python code?

Before I used the command line:

command = ["sudo","gphoto2","--set-config","manualfocusdrive=6","--set-config","capturetarget=1","--capture-image"]
call(command)
jim-easterbrook commented 5 years ago

You could try the set-capture-target.py example.

francophongvu commented 5 years ago

Thanks Jim for your response. I solved my issues with your suggestions.