error creating new gnucash file with python
Ulrich Möhrke
ulr_gnucash_user at moehrkevielfalt.de
Mon Nov 24 00:10:28 EST 2014
Hi Geert,
thank you very much for your answer and the workaround.
Am Sonntag, den 23.11.2014, 18:21 +0100 schrieb Geert Janssens:
> On Saturday 22 November 2014 22:51:33 Ulrich Möhrke wrote:
> > I wrote a tiny script:
> > -----------------------------------------
> > from gnucash import Session
> > from sys import argv
> > new_book_session = Session(argv[1], is_new=True)
> > -----------------------------------------
> >
> > .........
> > How to get rid of these errors?
>
> It looks like you have found a bug in the python bindings. It seems to
> have been introduced in an attempt to fix another bug [1].
>
> I have reopened that bug for further investigation.
>
> As a temporary workaround you could alter
> /usr/lib/python2.7/dist-packages/gnucash/gnucash_core.py
> In line 105 you will find:
> self.load()
> Replace this with
> if not is_new:
> self.load()
>
I could create a new file after this change. I used the example script
new_book_with_opening_balances.py
(http://svn.gnucash.org/docs/HEAD/new__book__with__opening__balances_8py_source.html)
A little bit surprising has been that I have to give the full path for
the target file or write the target path without xml:// at the
beginning. Else the target is written to directory $HOME/.gnucash/data/.
But this may be another another bug or feature.
>
> [1] https://bugzilla.gnome.org/show_bug.cgi?id=726891
>
Regards,
Ulrich
More information about the gnucash-user
mailing list