Issues with GList Arguments in Python Bindings?

Oliver Trevor olt at mit.edu
Sat Mar 8 17:57:15 EST 2025


Hello Gnucash developers,

      I was attempting to use the Gnucash Python bindings to apply payments to a list of invoices using Customer.ApplyPayment (which maps to gncOwnerApplyPaymentSecs on the C side), but it gives an error "TypeError: in method 'gncOwnerApplyPaymentSecs', argument 3 of type 'GList *'" when I attempt to pass a Python list of lots as the second argument "lots" (third argument on the C side).

     Looking at how the SWIG bindings were written, I think the issue may be that there is not a type translator that turns Python lists into GList. base-typemaps.i has a SWIG type translator on line 269 that converts Python lists into GSList objects, but as far as I can tell there isn't one that converts Python lists into GList objects.

     Am I correct that this is an issue, or am I missing how the bindings are intended to be used? If it's an issue, I could work on a PR to add a type translator for GList. Also, has anybody ever tried making bindings using GObject introspection instead of SWIG, since Gnucash's API is already GLib-based?

Thanks,
Oliver Trevor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20250308/6d340c02/attachment.htm>


More information about the gnucash-devel mailing list