[GNC-dev] Session creation fails in Python with TypeError

c.holtermann at gmx.de c.holtermann at gmx.de
Mon Jul 6 06:36:28 EDT 2020


Hello,

the mentioned pull request should fix this issue. Thank you for your
suggestion on github.

regards,

Christoph Holtermann

Am 2020-06-30 19:11, schrieb Peter Zimmerer:
> Hi all,
>
> playing around with the Python bindings in GnuCash 4.0 I have got the
> following stack trace from example script simple_book.py:
>
>
> uri: xml:///tmp/simple_book.gnucash
> Traceback (most recent call last):
>   File "simple_book.py", line 14, in <module>
>     with Session(uri, is_new=True) as ses:
>   File "/usr/local/lib/python3/dist-packages/gnucash/gnucash_core.py",
> line 131, in __init__
>     self.begin(book_uri, ignore_lock, is_new, force_new)
>   File "/usr/local/lib/python3/dist-packages/gnucash/gnucash_core.py",
> line 185, in new_function
>     return_value = function(self, *args)
>   File
> "/usr/local/lib/python3/dist-packages/gnucash/function_class.py",
> line 94, in method_function
>     *process_list_convert_to_instance(meth_func_args) )
> TypeError: qof_session_begin() takes 3 positional arguments but 5 were
> given
>
>
> This seams to be caused by changing the interface of function
> qof_session_begin from the triple (ignore_lock, create, force) to a
> SessionOpenMode in GnuCash 4.0.
>
> Pull request https://github.com/Gnucash/gnucash/pull/748 is a try to
> fix
> this for the python bindings in a compatible way by introducing a new
> (session_)open_mode as a new keyword parameter and use it instead of
> the
> Boolean triple to call the C function.
>
> If you decide to take over the pull request please review it carefully
> because I'm not an experienced Python programmer.
>
> Kind regards,
> Peter
>
>
> _______________________________________________
> 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