error creating new gnucash file with python
Ulrich Möhrke
ulr_gnucash_user at moehrkevielfalt.de
Sat Nov 22 16:51:33 EST 2014
Hello,
I try to create a new gnucash file with python as done within
example new_book_with_opening_balances.py
(http://svn.gnucash.org/docs/HEAD/new__book__with__opening__balances_8py_source.html).
I wrote a tiny script:
-----------------------------------------
from gnucash import Session
from sys import argv
new_book_session = Session(argv[1], is_new=True)
-----------------------------------------
I get errors, if I call the script.
First. - Call the script as
python new_session.py xml://xml_test.gnucash
I get the error:
Traceback (most recent call last):
File "new_session.py", line 3, in <module>
new_book_session = Session(argv[1], is_new=True)
File "/usr/lib/python2.7/dist-packages/gnucash/gnucash_core.py", line 105, in __init__
self.load()
File "/usr/lib/python2.7/dist-packages/gnucash/gnucash_core.py", line 144, in new_function
self.raise_backend_errors(function.__name__)
File "/usr/lib/python2.7/dist-packages/gnucash/gnucash_core.py", line 122, in raise_backend_errors
errors )
gnucash.gnucash_core.GnuCashBackendException: call to new_function resulted in the following errors, ERR_FILEIO_UNKNOWN_FILE_TYPE
Second. - Call the script as
python new_session.py sqlite3://sqlite_test.gnucash
Traceback (most recent call last):
File "new_session.py", line 3, in <module>
new_book_session = Session(argv[1], is_new=True)
File "/usr/lib/python2.7/dist-packages/gnucash/gnucash_core.py", line 104, in __init__
self.begin(book_uri, ignore_lock, is_new, force_new)
File "/usr/lib/python2.7/dist-packages/gnucash/gnucash_core.py", line 144, in new_function
self.raise_backend_errors(function.__name__)
File "/usr/lib/python2.7/dist-packages/gnucash/gnucash_core.py", line 122, in raise_backend_errors
errors )
gnucash.gnucash_core.GnuCashBackendException: call to begin resulted in the following errors, ERR_BACKEND_NO_HANDLER
I get the same errors calling the example script new_book_with_opening_balances.py.
How to get rid of these errors?
Thanks, Ulrich
More information about the gnucash-user
mailing list