[GNC-dev] Session creation fails in Python with TypeError
Peter Zimmerer
pkzw at web.de
Tue Jun 30 13:11:58 EDT 2020
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20200630/ca63e860/attachment.sig>
More information about the gnucash-devel
mailing list