Python bindings: Account.getName() raises TypeError

Geert Janssens janssens-geert at telenet.be
Mon Mar 17 09:51:37 EDT 2014


On Monday 17 March 2014 10:21:16 Mike Evans wrote:
> On Sun, 16 Mar 2014 13:41:42 -0700
> 
> David Osguthorpe <david.osguthorpe at gmail.com> wrote:
> > On Sun, Mar 16, 2014 at 08:54:10PM +0100, Felix Schwarz wrote:
> > > Am 16.03.2014 20:38, schrieb John Ralls:
> > > > The signature of xaccAccountGetName is const char*
> > > > xaccAccountGetName (const Account *); the const was added in
> > > > 2005. A "const Account *" is not the same as an "Account const
> > > > *": The former means that the contents of the pointer won't
> > > > change, the latter means that the pointer itself won't change
> > > > (see https://www.cs.bu.edu/teaching/cpp/const/).
> > > > 
> > > > Somewhere in the SWIG-generated Python-to-C translation code the
> > > > argument type is wrong, but it's not directly in the stack
> > > > trace from Python. It's more likely due to a change in SWIG
> > > > than to a change in GnuCash.> > 
> > > Thank you very much for the insights - seems really easy to miss.
> > > I'll take a look at the SWIG files and the generated code then.
> > > 
> > > But that means it would be interesting if gnucash's example script
> > > " " works for anyone, right? If we had a
> > > success report this might provide some insight about the relevant
> > > swig changes.> 
> > not all the example scripts work - but this one does for me
> > (the business ones have issues)
> > 
> > also you need slightly different arguments now because of the
> > xml/sqlite possibility
> > 
> > David
> 
> new_book_with_opening_balances.py works for me too on Fedora18 and
> SWIG Version 2.0.8.
> 
> Mike E

It's likely due to a change in swig as John suggested: I get the error on Fedora 20 (x8_64) 
with latest git version of gnucash and swit 2.0.11.

Geert


More information about the gnucash-devel mailing list