[GNC-dev] Python bindings: Exception when calling GetDatePosted on unposted invoice

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[GNC-dev] Python bindings: Exception when calling GetDatePosted on unposted invoice

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
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel
Reply | Threaded
Open this post in threaded view
|

Re: [GNC-dev] Python bindings: Exception when calling GetDatePosted on unposted invoice

Geert Janssens-4
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
> [hidden email]
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel




_______________________________________________
gnucash-devel mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel
Reply | Threaded
Open this post in threaded view
|

Re: [GNC-dev] Python bindings: Exception when calling GetDatePosted on unposted invoice

Frank Oltmanns
Thank you, Geert, for the fast response! I'm sorry for not finding this before posting.

Am 6. Februar 2019 19:37:50 MEZ schrieb Geert Janssens <[hidden email]>:

>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
>> [hidden email]
>> https://lists.gnucash.org/mailman/listinfo/gnucash-devel

--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
_______________________________________________
gnucash-devel mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel