[GNC] Python bindings ERROR <GLib> g_variant_unref: assertion 'value != NULL' failed

Gere Kiss Zsolt zsolt.gkiss at gmail.com
Mon Aug 12 12:14:33 EDT 2024


Hi all,

I've been using GnuCash for several years now and I'd like to try some
Python bindings to enter transactions programmatically.

I've browsed all the documentation I've seen on the topic. Unfortunately
all my attempts stop with an ERROR <GLib> g_variant_unref: assertion 'value
!= NULL' failed when trying to import gnucash. Here is my system info:

OS: Ubuntu 22.04.4 LTS

OS package gnucash installed with apt:

Package: gnucash
Version: 1:4.8-1build2
New: yes
State: installed
Automatically installed: no
Priority: extra
Section: universe/gnome
Maintainer: Ubuntu Developers <ubuntu-devel-discuss at lists.ubuntu.com>
Architecture: amd64
Uncompressed Size: 32,7 M
Depends: gnucash-common (= 1:4.8-1build2), guile-3.0-libs,
libaqbanking44 (>= 5.99.43), libboost-filesystem1.74.0 (>= 1.74.0),
libboost-locale1.74.0
         (>= 1.74.0), libboost-program-options1.74.0 (>= 1.74.0),
libboost-regex1.74.0-icu70, libc6 (>= 2.34), libcairo2 (>= 1.2.4),
libdbi1 (>=
         0.9.0), libgcc-s1 (>= 3.3.1), libgdk-pixbuf-2.0-0 (>=
2.22.0), libglib2.0-0 (>= 2.45.3), libgtk-3-0 (>= 3.21.5),
libgwengui-gtk3-79 (>=
         5.4.0~), libgwenhywfar79 (>= 4.1.0), libicu70 (>= 70.1-1~),
libofx7 (>= 0.9.14), libpango-1.0-0 (>= 1.18.0), libpangocairo-1.0-0
(>= 1.14.0),
         libpython3.10 (>= 3.10.0), libsecret-1-0 (>= 0.7), libstdc++6
(>= 11), libwebkit2gtk-4.0-37 (>= 2.30.1~), libxml2 (>= 2.7.4), zlib1g
(>=
         1:1.1.4), perl:any, guile-3.0 | guile-2.2 | guile-2.0,
libfinance-quote-perl, libwww-perl, libhtml-tree-perl,
libhtml-tableextract-perl,
         libcrypt-ssleay-perl, libdate-manip-perl
Recommends: gnucash-docs, python3-gnucash, yelp
Suggests: libdbd-mysql, libdbd-pgsql, libdbd-sqlite3
Breaks: gnucash-common (< 1:2.4.8-1~)
Replaces: gnucash-common (< 1:2.4.8-1~)

GnuCash version shown on the UI: 4.8 (but tried also 5.X, to no avail)

Other gnucash related OS packages:

   - gnucash-common
   - gnucash-docs
   - python3-gnucash

The package python3-gnucash contains the bindings shared libraries, like:

/usr/lib/python3/dist-packages/gnucash
/usr/lib/python3/dist-packages/gnucash/__init__.py
/usr/lib/python3/dist-packages/gnucash/_gnucash_core_c.cpython-310-x86_64-linux-gnu.so
/usr/lib/python3/dist-packages/gnucash/_sw_app_utils.cpython-310-x86_64-linux-gnu.so
/usr/lib/python3/dist-packages/gnucash/_sw_core_utils.cpython-310-x86_64-linux-gnu.so
...

and /usr/lib/python3/dist-packages is in the Python sys path. However:

Python 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gnucash
* 11:41:04 ERROR <GLib> g_variant_unref: assertion 'value != NULL' failed

Can somebody give a clue about why this happens?

Thank you,
   Zsolt

---------------------------------------------------------------------------------------------------
„We have two lives, and the second begins when we realize we only have one.”
-- Confucius


More information about the gnucash-user mailing list