From 02397302c6e7f79673533751839d5c6f39c9a289 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 14 Jul 2013 09:29:17 +0200 Subject: [PATCH] catch missing save_cache_path in xdg.BaseDirectory; closes #31 --- morituri/common/directory.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/morituri/common/directory.py b/morituri/common/directory.py index e076a1f..47aac11 100644 --- a/morituri/common/directory.py +++ b/morituri/common/directory.py @@ -44,7 +44,8 @@ class Directory(log.Loggable): from xdg import BaseDirectory path = BaseDirectory.save_cache_path('morituri') self.info('Using XDG, cache directory is %s' % path) - except ImportError: + except (ImportError, AttributeError): + # save_cache_path was added in pyxdg 0.25 path = os.path.join(os.path.expanduser('~'), '.morituri', 'cache') if not os.path.exists(path): os.makedirs(path) @@ -65,7 +66,8 @@ class Directory(log.Loggable): path = BaseDirectory.save_cache_path('morituri') self.info('For XDG, read cache directory is %s' % path) paths.append(path) - except ImportError: + except (ImportError, AttributeError): + # save_cache_path was added in pyxdg 0.21 pass path = os.path.join(os.path.expanduser('~'), '.morituri', 'cache')