update example scripts to SessionOpenMode

This commit is contained in:
c-holtermann
2020-06-12 12:24:05 +02:00
parent b073dbc5c3
commit ee77b713c2
11 changed files with 46 additions and 25 deletions

View File

@@ -3,11 +3,12 @@
# @brief Creates a basic set of accounts and a couple of transactions
# @ingroup python_bindings_examples
from gnucash import Session, Account, Transaction, Split, GncNumeric
from gnucash import (
Session, Account, Transaction, Split, GncNumeric, SessionOpenMode)
FILE_1 = "/tmp/example.gnucash"
with Session("xml://%s" % FILE_1, is_new=True) as session:
with Session("xml://%s" % FILE_1, SessionOpenMode.SESSION_NEW_STORE) as session:
book = session.book
root_acct = Account(book)
@@ -80,4 +81,4 @@ with Session("xml://%s" % FILE_1, is_new=True) as session:
trans1.CommitEdit()
trans2.CommitEdit()
trans2.CommitEdit()