GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
simple_book.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 ## @file
4 # @brief Simple example for a book
5 # @ingroup python_bindings_examples
6 
7 import sys
8 from gnucash import Session
9 
10 # We need to tell GnuCash the data format to create the new file as (xml://)
11 uri = "xml:///tmp/simple_book.gnucash"
12 
13 print "uri:", uri
14 ses = Session(uri, is_new=True)
15 book = ses.get_book()
16 
17 #Call some methods that produce output to show that Book works
18 book.get_root_account().SetDescription("hello, book")
19 print "Book is saved:", not book.session_not_saved()
20 
21 print "saving..."
22 ses.save()
23 
24 print "Book is saved:", not book.session_not_saved()
25 ses.end()