Uncaught critical error in the python bindings without apparent cause

mail at janno-kaiser.de mail at janno-kaiser.de
Tue Apr 10 18:51:06 EDT 2012


Hi,

I've run into an error using the python bindings:

This is the code (changed a bit to make it easier to read):

c = book.CustomerLookupByID(customerid)
assert( isinstance(c, Customer) )
CUR = c.GetCurrency()
assert( isinstance(CUR, GncCommodity) )

invoice = Invoice(
             book=book,
             id=next_invoice_id,
             currency=CUR,
             owner=c
             )

It goes through without throwing an exception but produces the following
output:

* 19:41:21  CRIT <gnc.backend.sql> gnc_sql_save_commodity: assertion
`pCommodity != NULL' failed
* 19:41:21  WARN <gnc.backend.sql> [add_gvalue_owner_to_slist()] Invalid
owner type: 0


I used pdb to investigate this:

- CUR is identical to book.get_table().lookup('CURRENCY', 'EUR')
- c is a customer created manually using the gnucash GUI and all it's
properties appear to be correct.
- next_invoice_id is "W000083".

I've stepped through the code. The first line ("CRIT") of the output
happens here:
/usr/lib/python2.7/dist-packages/gnucash/gnucash_core_c.py (3379)
gncInvoiceSetID()
-> return _gnucash_core_c.gncInvoiceSetID(*args)

which is the result of this function call:
> /usr/lib/python2.7/dist-packages/gnucash/gnucash_business.py (178)
__init__()
-> self.SetID(id)

The "WARN" output is caused by this:
> /usr/lib/python2.7/dist-packages/gnucash/gnucash_core_c.py (3407)
gncInvoiceSetCurrency()
-> return _gnucash_core_c.gncInvoiceSetCurrency(*args)

which is the result of a simple SetCurrency in Invoice.__init__, one
line after SetID.

I'm very confused. How is the ID related to pCommodity and how is the
currency related to the owner type? Since I've stepped through every
function call I'm certain that the output happens at the locations I
mentioned but it just doesn't make any sense to me.

My gnucash version:
GnuCash 2.4.10
Built 2012-03-05 from r21973

I don't know how to find the source of this problem. I'd appreciate any
input.

Best Regards,
Jan-Oliver Kaiser


More information about the gnucash-devel mailing list