sdementen / piecash

Pythonic interface to GnuCash SQL documents
Other
288 stars 75 forks source link

Problem opening XML file #198

Closed audunmg closed 2 years ago

audunmg commented 2 years ago

According to the readme, this can open XML files, but I can't seem to change from SQLite to XML:

In [2]: open_book('gnucash.gnucash')
---------------------------------------------------------------------------
GnucashException                          Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 open_book('gnucash.gnucash')

File /usr/lib/python3.10/site-packages/piecash/core/session.py:409, in open_book(sqlite_file, uri_conn, readonly, open_if_lock, do_backup, db_type, db_user, db_password, db_name, db_host, db_port, check_same_thread, check_exists, **kwargs)
    407 # check if the database exists
    408 if check_exists and not database_exists(uri_conn):
--> 409     raise GnucashException(
    410         "Database '{}' does not exist (please use create_book to create "
    411         "GnuCash books from scratch). If you want to bypass this existence check, "
    412         "use the argument check_exists=False.".format(uri_conn)
    413     )
    415 engine = create_piecash_engine(uri_conn, **kwargs)
    417 # backup database if readonly=False and do_backup=True

GnucashException: Database 'sqlite:///gnucash.gnucash' does not exist (please use create_book to create GnuCash books from scratch). If you want to bypass this existence check, use the argument check_exists=False.

Perhaps I'm missing something?

sdementen commented 2 years ago

It can't open XML file only SQL based formats. Where have you seen that it can open XML?

audunmg commented 2 years ago

Line 46 of README.rst says:

Perhaps it needs some clarification (or maybe me?). I'm definitively misunderstanding something here.

sdementen commented 2 years ago

Indeed, a but confusing. It is an alternative to reading the XML file.

piecash test suite runs successfully on Windows and Linux on the three supported SQL backends (sqlite3, Postgres and MySQL) => it only supports SQL backends

audunmg commented 2 years ago

I see. I will migrate to SQL so I can use this.

Thank you for your answer and for this project!