jim-easterbrook / python-gphoto2

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

Is there a reference for what is accessible inside these "swig" objects? #41

Closed ELI7VH closed 6 years ago

ELI7VH commented 6 years ago

Hello. I am trying to look inside what is returned from these methods, such as man = gp.gp_camera_get_manual(camera) for example, and it gives me this array [-6, <Swig Object of type 'CameraText *' at 0x76a3b880>]

how can I look at what is inside this swig object as a string or list?

jim-easterbrook commented 6 years ago

The first element of the list is the C function's return status, in this case -6 which is GP_ERROR_NOT_SUPPORTED. See http://www.gphoto.org/doc/api/gphoto2-port-result_8h.html for a list of status values.

The second element is a CameraText object (Python wrapper around a C struct) that has one member called text. See http://www.gphoto.org/doc/api/structCameraText.html for more detail. You can access the text string by using str() as in the choose-camera.py example or as a Python attribute, in your case this would be man[1].text.

ELI7VH commented 6 years ago

ok thanks. I finally found it after digging a while. Thanks this reference > http://www.gphoto.org/doc/api/ is precisely what I needed!