I'm trying to use the python bindings to fetch entry (line-item) data from an invoice.
See http://pastebin.com/fy06CPup for the test GnuCash XML file I'm using. I expect the script below to print the three line items from the invoice in that file, but instead it dies with: % gnucash-env python invoice_read.py test2.gnucash * 15:07:39 WARN <gnc.backend.dbi> [gnc_module_init_backend_dbi()] No DBD drivers found Traceback (most recent call last): File "invoice_read.py", line 16, in <module> print entry.GetDescription() File "/usr/lib/python2.6/dist-packages/gnucash/function_class.py", line 92, in method_function *process_list_convert_to_instance(meth_func_args) ) File "/usr/lib/python2.6/dist-packages/gnucash/gnucash_core_c.py", line 3825, in gncEntryGetDescription return _gnucash_core_c.gncEntryGetDescription(*args) TypeError: in method 'gncEntryGetDescription', argument 1 of type 'GncEntry const *' Other methods on the Entry objects yield similar results. (A similar approach to the code below with Invoice and Customer objects works ok.) Running on Ubuntu Lucid. Tested with 2.4.0-1~getdeb1~lucid from getdeb.net and from svn with the same results. Can someone point out what I'm doing wrong? Thanks. -- Brian St. Pierre #!/usr/bin/env python import os import sys from gnucash import Session from gnucash.gnucash_business import Entry uri = "xml://{0}".format(os.path.abspath(sys.argv[1])) ses = Session(uri, is_new=False) try: book = ses.get_book() invoice = book.InvoiceLookupByID('0001') assert(len(invoice.GetEntries()) == 3) for e in invoice.GetEntries(): entry = Entry(instance=e) print entry.GetDescription() finally: ses.end() _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel