I get a Python GncOwner object returned to Python. It appears well formed. owner: <class 'gnucash.gnucash_core.GncOwner'> <gnucash.gnucash_core.GncOwner object at 0x7f33d4cc3050> owner_instance: <class 'tuple'> (4, <Swig Object of type 'GncVendor *' at 0x7f214b5a9500>)
It's not clear how to easily inspect the Swig object. However, the object doesn't convert back to C. It's not recognized as GncVendor. I get: ValueError: Python object passed to function with GncOwner * argument couldn't be converted back to pointer of that type The out typemap for GncOwner looks correct. However, I can't see how the in typemap gets the swig wrapper object from the tuple created by the out typemap. I can recreate the problem in simple_business_create.py with the attached patch. If there is nothing obviously wrong with the typemaps, how should I go about debugging this? Thanks, Steve
diff --git a/bindings/python/example_scripts/simple_business_create.py b/bindings/python/example_scripts/simple_business_create.py index 029a4f530..2b7e4d1c4 100644 --- a/bindings/python/example_scripts/simple_business_create.py +++ b/bindings/python/example_scripts/simple_business_create.py @@ -134,6 +134,11 @@ try: invoice_customer = Invoice(book, "5", CAD, new_customer) customer_extract = invoice_customer.GetOwner() + print('customer_extract: ', type(customer_extract), customer_extract) + owner = customer_extract.GetEndOwner() + print('owner: ', type(owner), owner, owner.get_instance()) + addr = owner.GetAddr() + print('addr: ', type(addr)) assert( isinstance(customer_extract, Customer) ) assert( customer_extract.GetName() == new_customer.GetName() )
_______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel