jim-easterbrook / python-gphoto2

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

capture-image and get-files not working #24

Closed chrisimars closed 6 years ago

chrisimars commented 7 years ago

Hi Jim, I am working with python-gphoto2 on a Raspberry Pi with a Nikon D7200 camera. I can perform all functions I have tried ok but having trouble getting files from camera. Neither the capture-image or get-files works. The camera SD-card access LED goes on but the program exits when it gets to the Camera_file = gp.check_result(gp.gp_camera_file_get( camera, file_path.folder, file_path.name, gp.GP_FILE_TYPE_NORMAL, context)) line. I then have to turn camera off and back on to talk to it again. I can get files and capture images from gphoto2, v2.5.10 with libgphoto2 2.5.4. Any ideas? Thanks, Chris

jim-easterbrook commented 7 years ago

Any error messages or other console output at all?

chrisimars commented 7 years ago

Jim, no the python program just quits. I have tried debugging via IDLE3 but it will not step into the call. Chris

jim-easterbrook commented 7 years ago

That's odd. I suspect you are getting a segfault or similar, although they're not usually silent. I assume you've called gp.use_python_logging() at the start of your program (and set up logging.basicConfig()) as in the python-gphoto2 example programs.

chrisimars commented 7 years ago

I have tried the example programs but I am not familiar with the logging, where do the messages go?

jim-easterbrook commented 7 years ago

You should get messages on the terminal where you run the program. It's best to use the command line for this sort of thing, rather than running in any sort of IDE.

chrisimars commented 7 years ago

Jim, ok let me try that and see if I get any messages that help. Thanks, Chris

chrisimars commented 7 years ago

Jim, whenever I try to run a program with the error logging I get the following message: WARNING: gphoto2: (gp_port_set_error [gphoto2-port.c:1186]) The supplied vendor or product id (0x0,0x0) is not valid. Not sure if that is related, I get this for functions that work in other programs without the logging. Chris

jim-easterbrook commented 7 years ago

libgphoto2 seems to produce a lot of messages that aren't really a problem. It's not easy to tell which ones matter and which don't. I take it you're still not getting anything useful from your program that exits abruptly. Can you try it on a different model of computer? (E.g. desktop Linux box instead of Raspberry Pi.)

chrisimars commented 7 years ago

Jim, not easily. I am now focusing on just getting a file from the camera. When you try to get the image the camera led for the storage card is on until you power cycle the camera. Maybe the lower level code is not handling the data transfer properly.

On the capture side, I found out that the Nikon camera I am using only allows you to get the image from a still capture if the image is stored in SDRAM. It sends events in that case with the imagebuffer as a parameter. How does python-gphoto2 handle events? Is that just in the libgphoto2 stuff?

Sorry to bother you with this but I am new to the gphoto2 stuff and want to get a camera working. I may try a Canon camera also. Thanks, Chris

jim-easterbrook commented 7 years ago

As far as I know the only libgphoto2 event handling (at the user program level) is gp_camera_wait_for_event(), which python-gphoto2 should handle OK.