jim-easterbrook / python-gphoto2

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

Always connected capture anytime #167

Open musaulker opened 7 months ago

musaulker commented 7 months ago

Hello,

I am trying to capture photo from time to time while the camera is connected to the computer. Photo capture works with library on initial try. But after some moment passes, maybe the camera is going sleep or usb connection is closed, for some reason i cannot take a picture any more without closing and opening the camera.

Is it possible to have a live connection with camera so i can took picture anytime and save on the computer?

I checked wait-for-event.py file which maybe a starting point but its not clear to trigger photo capture from python while connection is active.

Any advice?

Thanks

jim-easterbrook commented 7 months ago

If the camera turns itself off then there isn't much you can do. Otherwise you could try resetting the port as described in bug #162.

        info = camera.get_port_info()
        port = gphoto2.GPPort()
        port.set_info(info)
        port.open()
        port.reset()