From 6d5d22d692b7b32414701f6579136f67ad13ceb9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 29 Apr 2010 17:04:58 -0600 Subject: [PATCH] Fix #5410 (Error communicating with device - PRS-600 - as I edit metadata) --- src/calibre/devices/prs505/driver.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index 448965a913..7facd4d3bb 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -202,9 +202,11 @@ class PRS505(CLI, Device): def write_card_prefix(prefix, listid): if prefix is not None and hasattr(booklists[listid], 'write'): - if not os.path.exists(prefix): - os.makedirs(prefix) - with open(prefix + self.__class__.CACHE_XML, 'wb') as f: + tgt = os.path.join(prefix, *(self.CACHE_XML.split('/'))) + base = os.path.dirname(tgt) + if not os.path.exists(base): + os.makedirs(base) + with open(tgt, 'wb') as f: booklists[listid].write(f) write_card_prefix(self._card_a_prefix, 1) write_card_prefix(self._card_b_prefix, 2)