Closed benoitguigal closed 7 years ago
I've not used gp_camera_wait_for_event
myself so I don't know what to expect. It's probably camera and/or driver dependent. This is a question about libgphoto2 rather than about the Python interface so it might be worth asking on the gphoto2 mailing list.
I've just looked at the documentation of gp_camera_wait_for_event
. The second parameter is a timeout value, but you are passing gp.GP_EVENT_FILE_ADDED
so your call is timing out in 2 milliseconds.
In gphoto2 version >= 2.5.6 it is possible to pass string value like 'FILEADDED' or 'CAPTURECOMPLETE' to the wait_event
function.
https://github.com/gphoto/gphoto2/blob/master/NEWS. Do you think it is possible to call this underlying function instead of the function with the timeout ?
python-gphoto2
is a Python interface to the libgphoto2
C library (see http://www.gphoto.org/doc/api/). It doesn't add functionality unless absolutely necessary, e.g. to use Python types. The gphoto2
command line tool is a separate entity. Its wait-event
option presumably uses gp_camera_wait_for_event
internally.
You can easily write your own Python function to call gp_camera_wait_for_event
repeatedly until it returns the event type you want.
ok it very clear, thanks a lot
I want to wait for a
GP_EVENT_FILE_ADDED
event. Here is my code:I would expect the function to wait until the event happen but instead it returns immediately
(0, None)
My workaround is to create a while loop like this:which is working but does not feel right. Any help would be greatly appreciated.