gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
1.02k stars 322 forks source link

gphoto2.GPhoto2 Error: [-107] Directory not found #414

Open uvedhe opened 5 years ago

uvedhe commented 5 years ago

Describe the bug

When the camera takes long exposure shots (~30 seconds), gphoto2 returns gphoto2.GPhoto2 Error: [-107] Directory not found after capture has finished (shutter closes). Running the exact same command for exposures that are shorter does not result in this error. (Commands are run from a Python 2.7 script)

Name the camera Sony DSC-A900 (PTP mode), although it's actually a Sony a850

libgphoto2 and gphoto2 version gphoto2 2.5.20 libgphoto2 2.5.22 -- actually 2.5.22.1 (from previous bug report a few months ago, using same camera) libgphoto2_port 0.12.0

To Reproduce

import gphoto2 as gp

# Create new instance
context = gp.Context()
camera = gp.Camera()

# Connect to camera
while True:
    error = gp.gp_camera_init(camera, context)
    if error >= gp.GP_OK:
        break
    if error != gp.GP_ERROR_MODEL_NOT_FOUND:
        raise gp.GPhoto2Error(error)
    time.sleep(2)

# take photo
file_path = gp.check_result(gp.gp_camera_capture(camera, gp.GP_CAPTURE_IMAGE))
target = os.path.join(filename_full)  # 'filename_full' is an existing path (with short exposures the image is saved without problem)
camera_file = gp.check_result(gp.gp_camera_file_get(
     camera, file_path.folder, file_path.name, gp.GP_FILE_TYPE_NORMAL))  # gphoto2.GPhoto2 Error: [-107] Directory not found
gp.check_result(gp.gp_file_save(camera_file, target))
uvedhe commented 5 years ago

Actually, opened an issue at gphoto2 also, because probably more to do with that than with libgphoto(?)

msmeissn commented 5 years ago

There is max limit of 35 seconds sony capture will wait for a picture to be added, then itz will error out..

for longer wait times, use trigger capture and wait_For_event