jim-easterbrook / python-gphoto2

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

Error in capture-image #44

Closed Nic2012 closed 6 years ago

Nic2012 commented 6 years ago

Installing python-gphoto2 on a fresh latest Raspian Stretch distro and Pi ZeroW. gphoto2 v 2.5.15, but when I call capture-image on a Nikon camera after setting target to memory card I got

Capturing image
Camera file path: /store_00010001/DCIM/167ND700/_NIC0875.JPG
Copying image to /tmp/_NIC0875.JPG
Traceback (most recent call last):
  File "capture-image.py", line 49, in <module>
    sys.exit(main())
  File "capture-image.py", line 44, in main
    subprocess.call(['xdg-open', target])
  File "/usr/lib/python2.7/subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Changing storage loc returns warnings:

python set-capture-target.py 1
WARNING: gphoto2: (_get_config [config.c:7471]) Type of property 'ISO Auto Hi Limit' expected: 0x0001 got: 0x0002
WARNING: gphoto2: (_get_config [config.c:7471]) Type of property 'Active D-Lighting' expected: 0x0001 got: 0x0002
WARNING: gphoto2: (_get_config [config.c:7471]) Type of property 'High ISO Noise Reduction' expected: 0x0001 got: 0x0002
WARNING: gphoto2: (_get_config [config.c:7471]) Type of property 'Flash Exposure Compensation' expected: 0x0002 got: 0x0001
WARNING: gphoto2: (ptp_usb_event [usb.c:530]) Reading PTP event failed: Timeout reading from or writing to the port (-10)

Target internal RAM returns nearly the same:

WARNING: gphoto2: (ptp_usb_getresp [usb.c:465]) PTP_OC 0x1002 receiving resp failed: PTP Session Already Opened (0x201e)
WARNING: gphoto2: (camera_init [library.c:7729]) 'ptp_opensession (params, sessionid)' failed: PTP Session Already Opened (0x201e)
Capturing image
WARNING: gphoto2: (camera_nikon_capture [library.c:3093]) Parentobject of newobject 0x2b000005 is 0x0 now?
Camera file path: //capt0000.jpg
Copying image to /tmp/capt0000.jpg
Traceback (most recent call last):
  File "capture-image.py", line 49, in <module>
    sys.exit(main())
  File "capture-image.py", line 44, in main
    subprocess.call(['xdg-open', target])
  File "/usr/lib/python2.7/subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Calling on gphoto2 cli returns no errors:

gphoto2 --capture-image
New file is in location /store_00010001/DCIM/167ND700/_NIC0876.JPG on the camera

But in all cases camera is storing images on mem card and I can see it later on display.

What do then all the errors and warnings mean? And why its mentioned "Copying image to /tmp/"?

Best regards, Nic

jim-easterbrook commented 6 years ago

The example script copies the image to /tmp before using xdg-open to view it with your default viewer. Your error messages suggest xdg-open doesn't exist or can't be found, so you probably need to install it. (Or rewrite the example script to do something else.) The numerous warning messages from the example scripts are normal. libgphoto2 logs lots of warnings for things that aren't errors.

Nic2012 commented 6 years ago

Ok, thanks for y support.