After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795359 - query.run() with Python3 not working anymore: "no object of type qof_class_get_parameter/qof_object_foreach"
query.run() with Python3 not working anymore: "no object of type qof_class_ge...
Status: RESOLVED DUPLICATE of bug 794526
Product: GnuCash
Classification: Other
Component: Python Bindings
3.0
Other Linux
: Normal normal
: future
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2018-04-18 15:44 UTC by Fabian Köster
Modified: 2018-06-30 00:08 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Fabian Köster 2018-04-18 15:44:56 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.
Comment 1 John Ralls 2018-04-19 00:14:17 UTC
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 ***
Comment 2 Tom Lofts 2018-05-18 08:37:41 UTC
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
Comment 3 John Ralls 2018-06-30 00:08:31 UTC
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.