From c5a3298144f600c212dba5f62400148335f7ac88 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 23 Feb 2011 18:32:03 +0100 Subject: [PATCH] create cache folder if needed --- pandora_client/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 77c5dea..8d5402e 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -91,7 +91,10 @@ class Client(object): conn.commit() def _conn(self): - db_conn = os.path.expanduser(self._config['cache']) + dbfile = self._config['cache'] + if not os.path.exists(os.path.dirname(dbfile)): + os.makedirs(os.path.dirname(dbfile)) + db_conn = os.path.expanduser(dbfile) conn = sqlite3.connect(db_conn, timeout=10) conn.text_factory = sqlite3.OptimizedUnicode return conn, conn.cursor()