GNOME Bugzilla – Bug 795359
query.run() with Python3 not working anymore: "no object of type qof_class_get_parameter/qof_object_foreach"
Last modified: 2018-06-30 00:08:31 UTC
I have a script which tries to get a list of all customers from GnuCash. The relevant part is: =============================== from gnucash import Query from gnucash.gnucash_core_c import GNC_ID_CUSTOMER query = Query() query.search_for(GNC_ID_CUSTOMER) query.set_book(s.book) customers = [] for index, result in enumerate(query.run()): customer = Customer(instance=result) customers.append(customer) query.destroy() ======================== I sucessfully used this with GnuCash 2.6 under Python 2 but it does not work anymore with Python 3 on GnuCash 3.0. This is the output I get: * 17:33:44 WARN <qof.class> [qof_class_get_parameter()] no object of type qof_class_get_parameter * 17:33:44 WARN <qof.class> [qof_class_get_parameter()] no object of type qof_class_get_parameter * 17:33:44 CRIT <qof.object> [qof_object_foreach()] No object of type qof_object_foreach Replacing the GNC_ID with the string 'gncCustomer' like done in the gnucash_rest example [1] does not help either. The culprint seems to be the query.run() command. Even when leaving out the entire loop and just stating query.run(), the mentioned messages are printed. [1] https://github.com/Gnucash/gnucash/blob/5e807a0e18f7ac90158f6ee4dac0920545fde7cc/bindings/python/example_scripts/rest-api/gnucash_rest.py#L768 Using Gentoo Linux.
Thanks for taking the time to report this. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 794526 ***
Hi John, I don't believe this is a duplicate of bug 794526 - Bug 794526 relates to problems with Gnucash loading the backend, occurs on initialisation and can be worked around by running Python from the root build directory. This bug occurs after initialisation when set_book is used and raises errors in the Qof functionality. While they both relate to the move to Python 3, I think the causes and resolutions are probably different. I also stumbled across the same bug and reported is as bug 796137 with some additional details. If you have any further queries on this please let me know. Tom
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=795359. Please update any external references or bookmarks.