diff options
Diffstat (limited to 'gnucashxml.py')
-rw-r--r-- | gnucashxml.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gnucashxml.py b/gnucashxml.py index 2a2599c..9014d29 100644 --- a/gnucashxml.py +++ b/gnucashxml.py @@ -183,7 +183,12 @@ class Split(object): def from_filename(filename): """Parse a GNU Cash file and return a Book object.""" - return parse(gzip.open(filename, "rb")) + try: + # try opening with gzip decompression + return parse(gzip.open(filename, "rb")) + except IOError: + # try opening without decompression + return parse(open(filename, "rb")) # Implemented: |