#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This program is Copyright (C) 2017, Paul Lutus # and is released under the GPL: # https://www.gnu.org/licenses/gpl-3.0.en.html from piecash import open_book balance = 0 def recurse(node,tab=''): global balance balance += node.get_balance() print("%-80s : %12.2f : %12.2f" % ("%s%s" % (tab,str(node)),node.get_balance(),balance)) for child in node.children: recurse(child, tab + ' ') # change this path to suit your needs data_path = '/netbackup/data/FINANCE/gnucash/all_accounts.sqlite3.gnucash' with open_book(data_path) as book: recurse(book.root_account)