jim-easterbrook/python-gphoto2

"gp_result_as_string not defined" & "gphoto2 has no attribute check_result" since mid-july '24?

Closed this issue ยท 4 comments

Hello,

I'm having issues using the lib. I'm not quite sure where the problem lies.

I was using a piece of code just a couple weeks ago (mid-july) with no issues. When I came back to it a couple of days ago, I did the usual apt-get update & pip upgrade and when launching my code, none of them were working anymore, including basic examples.
Being novice in linux & python, it may very well be something very simple/stupid, please bear with me ๐Ÿ˜Š any help appreciated

I'll get errors such as :

Traceback (most recent call last):
File "/[mypath]/env/lib/python3.11/site-packages/gphoto2/init.py", line 25, in init
string = gp_result_as_string(code)
NameError: name 'gp_result_as_string' is not defined

And trying one of your examples "camera-summary" which I believed worked fine now gives :
File "/[mypath]/gphoto2 examples/camera-summary.py", line 51, in
sys.exit(main())
File "[mypath]/gphoto2 examples/camera-summary.py", line 35, in main
callback_obj = gp.check_result(gp.use_python_logging())
AttributeError: module 'gphoto2' has no attribute 'check_result'

My code is running on a RPI 5 standard raspberry PI OS, python 3.11.

*Then I installed the python-gphoto2 from my virtualenv (working fine)
$ pip3 install gphoto2 --user --only-binary :all:

Some diags :
$pip3 show gphoto2 :
(env) $ pip3 show gphoto2
Name: gphoto2
Version: 2.5.0
Summary: Python interface to libgphoto2
Home-page: https://github.com/jim-easterbrook/python-gphoto2
Author:
Author-email: Jim Easterbrook jim@jim-easterbrook.me.uk
License: GNU LGPL
Location: /home/sygolene/GitHub/env/lib/python3.11/site-packages

$ apt show libexif12 libgphoto2-6 libgphoto2-port12 libltdl7

Package: libexif12
Version: 0.6.24-1+b1
Priority: optional
Section: libs
Source: libexif (0.6.24-1)
Maintainer: Debian PhotoTools Maintainers pkg-phototools-devel@lists.alioth.debian.org
Installed-Size: 2,684 kB
Depends: libc6 (>= 2.29)
Homepage: https://libexif.github.io/
Tag: role::shared-lib
Download-Size: 396 kB
APT-Manual-Installed: yes
APT-Sources: http://deb.debian.org/debian bookworm/main arm64 Packages
Description: library to parse EXIF files
Most digital cameras produce EXIF files, which are JPEG files with
extra tags that contain information about the image. The EXIF library
allows you to parse an EXIF file and read the data from those tags.

Package: libgphoto2-6
Version: 2.5.30-1
Priority: optional
Section: libs
Source: libgphoto2
Maintainer: Debian PhotoTools Maintainers pkg-phototools-devel@alioth-lists.debian.net
Installed-Size: 3,561 kB
Depends: libc6 (>= 2.33), libcurl4 (>= 7.16.2), libexif12 (>= 0.6.21-1~), libgd3 (>= 2.1.0alpha), libgphoto2-port12 (>= 2.5.30), libjpeg62-turbo (>= 1.3.1), libltdl7 (>= 2.4.7), libxml2 (>= 2.7.4)
Recommends: libgphoto2-l10n (= 2.5.30-1)
Suggests: gphoto2
Homepage: https://github.com/gphoto/libgphoto2/
Tag: role::shared-lib
Download-Size: 716 kB
APT-Sources: http://deb.debian.org/debian bookworm/main arm64 Packages
Description: gphoto2 digital camera library
The gphoto2 library can be used by applications to access various
digital camera models, via standard protocols such as USB Mass Storage
and PTP, or vendor-specific protocols.
.
This package contains the library.
.
The gphoto2 command-line frontend is shipped separately, in the gphoto2
package.

Package: libgphoto2-port12
Version: 2.5.30-1
Priority: optional
Section: libs
Source: libgphoto2
Maintainer: Debian PhotoTools Maintainers pkg-phototools-devel@alioth-lists.debian.net
Installed-Size: 813 kB
Depends: libc6 (>= 2.33), libltdl7 (>= 2.4.7), libusb-1.0-0 (>= 2:1.0.8)
Suggests: gphoto2
Breaks: libgphoto2-port10 (>= 2.5.7)
Replaces: libgphoto2-port10 (>= 2.5.7)
Homepage: https://github.com/gphoto/libgphoto2/
Tag: role::shared-lib
Download-Size: 134 kB
APT-Sources: http://deb.debian.org/debian bookworm/main arm64 Packages
Description: gphoto2 digital camera port library
The gphoto2 library can be used by applications to access various
digital camera models, via standard protocols such as USB Mass Storage
and PTP, or vendor-specific protocols.
.
This package contains the runtime code for port access.

Package: libltdl7
Version: 2.4.7-7~deb12u1
Priority: optional
Section: libs
Source: libtool
Maintainer: Alastair McKinstry mckinstry@debian.org
Installed-Size: 460 kB
Depends: libc6 (>= 2.34)
Homepage: https://www.gnu.org/software/libtool/
Tag: role::shared-lib
Download-Size: 392 kB
APT-Manual-Installed: yes
APT-Sources: http://deb.debian.org/debian bookworm/main arm64 Packages
Description: System independent dlopen wrapper for GNU libtool
This package contains the run-time libltdl library.
.
A small library that aims at hiding the various difficulties of
dlopening libraries from programmers. It is a system independent
dlopen wrapper for GNU libtool.
.
It supports the following dlopen interfaces:

  • dlopen (Solaris, Linux and various BSD flavors)
  • shl_load (HP-UX)
  • LoadLibrary (Win16 and Win32)
  • load_add_on (BeOS)
  • GNU DLD (emulates dynamic linking for static libraries)
  • libtool's dlpreopen

Was there any changes in the last few days? on both your side and libgphoto, there doesn't seem to have been any updates...

Thanks very much in advance,

[Edit - you do say what you're running on but I missed it.]
I believe the Raspberry Pi 5 has an aarch64 architecture, so it's not yet supported by https://www.piwheels.org/project/gphoto2/

This means that you need to build python-gphoto2 during installation, after any change to your "system" libgphoto2:

pip3 install gphoto2 --user --force-reinstall --no-binary :all:

The --force-reinstall is probably needed as there isn't a new release of python-gphoto2 so pip will assume nothing needs to be done. (Drop the --user if installing in a virtual environment.)

I can confirm that there have been no releases of my python-gphoto2 since last September.

Hello Jim,

Huge thanks for your dedication, I noticed you updated 2 or 3 times by the time I was trying things and the last "force reinstall" seems to have fixed it.
Still not entirely clear what happened between then and now but many thanks !

What I think happened is that you updated libgphoto2, which broke the python-gphoto2 that was using it. Running pip to reinstall python-gphoto2 did nothing as there isn't a new release so pip assumed it was up to date. Using --force-reinstall over-rules that logic and made pip rebuild python-gphoto2 with the new libgphoto2.