From 5695c8196ae41ef4bbecf1971ae2449931b734a0 Mon Sep 17 00:00:00 2001 From: Patrick Speiser Date: Sun, 7 Oct 2012 05:51:55 +0200 Subject: [PATCH] Calling _findfilesstartingwith with a non-existing folder would raise an exception, will return an empty list now --- headphones/cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/headphones/cache.py b/headphones/cache.py index 9592e8f3..78cd0c47 100644 --- a/headphones/cache.py +++ b/headphones/cache.py @@ -65,7 +65,8 @@ class Cache(object): def _findfilesstartingwith(self,pattern,folder): files = [] - for fname in os.listdir(folder): + if os.path.exists(folder): + for fname in os.listdir(folder): if fname.startswith(pattern): files.append(os.path.join(folder,fname)) return files