[GNC] Python bindings broken?

Thomas Klausner wiz at gatalith.at
Sat Dec 7 09:38:55 EST 2024


Hi!

I’m using Gnucash 5.9 on NetBSD with Python 3.13.1.
I have a script that I run every half a year or so, and I ran it again today, and it didn’t work.
The last time I ran it (successfully) was in April, so with Gnucash 5.6 and Python 3.12, I think.

The symptoms are that:
- The root account has no children or descendants 
- Ending the session doesn’t remove the “.LCK” file.

I’ve simplified the script to the following:



#!/usr/bin/env python3

  import gnucash


  session = gnucash.Session("test.gnucash")
  root_account = session.book.get_root_account()
  for child in root_account.get_children():
      print(child.GetName())
  for child in root_account.get_descendants():
      print(child.GetName())
  session.end()


It should iterate over all accounts and print all of their names (once using get_children(), once using get_descendants()). I only tried get_descendants() because get_children() didn’t work.

Does this work for others (with Python 3.13?) or is this currently broken?

Any ideas what the problem could be or how to debug this?

Thanks,
 Thomas



More information about the gnucash-user mailing list