GnuCash 2.4.99
simple_book.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 ##  @file
00004 #   @brief Simple example for a book 
00005 #   @ingroup python_bindings_examples
00006 
00007 import sys
00008 from gnucash import Session
00009 
00010 # We need to tell GnuCash the data format to create the new file as (xml://)
00011 uri = "xml:///tmp/simple_book.gnucash"
00012 
00013 print "uri:", uri
00014 ses = Session(uri, is_new=True)
00015 book = ses.get_book()
00016 
00017 #Call some methods that produce output to show that Book works
00018 book.get_root_account().SetDescription("hello, book")
00019 print "Book is saved:", not book.not_saved()
00020 
00021 print "saving..."
00022 ses.save()
00023 
00024 print "Book is saved:", not book.not_saved()
00025 ses.end()
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines