[GNC-dev] Python bindings: Exception when calling GetDatePosted on unposted invoice
Geert Janssens
geert.gnucash at kobaltwit.be
Wed Feb 6 13:37:50 EST 2019
Hi Frank,
I believe this is
https://bugs.gnucash.org/show_bug.cgi?id=796893
That bug has been fixed for gnucash 3.4.
Regards,
Geert
Op woensdag 6 februari 2019 19:19:57 CET schreef Frank Oltmanns:
> Dear all,
>
> I'm using the python bindings from GnuCash 3.3 (debian package from sid).
> When calling GetDatePosted() on an unposted invoice a get the following
> exception:
> ValueError: month must be in 1..12
>
> This function is used in the example scripts that are part of GnuCash
> (gnucash_simple.py). In this example the exception is not caught but
> instead there is a check if the date is 1970-01-01 (of course it never
> comes to the check because of the exception).
>
> This is the stack trace:
> File "/path/to/gnucash_helper/gnucash_simple.py", line 161, in
> invoiceToDict
> if invoice.GetDatePosted().strftime('%Y-%m-%d') == '1970-01-01':
> File "/usr/lib/python3/dist-packages/gnucash/function_class.py", line 91,
> in method_function
> *process_list_convert_to_instance(meth_func_args) )
> File "/usr/lib/python3/dist-packages/gnucash/gnucash_core_c.py", line
> 3919, in gncInvoiceGetDatePosted
> return _gnucash_core_c.gncInvoiceGetDatePosted(invoice)
>
> Is this something that has changed since GnuCash 2.6 and was
> gnucash_simple.py has not been updated accordingly? Or is this an error in
> _gnucash_core_c.gncInvoiceGetDatePosted()?
>
> I mean, should I design my application to expect the exception or should
> this be fixed in the python bindings. If it is the latter, I'd appreciate
> any pointers on where I should start looking.
>
> Best regards
> Frank
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
More information about the gnucash-devel
mailing list