diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index c323b1a2a2..6a3ea9ba48 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -721,7 +721,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): path = self.format_abspath(index, format, index_is_id=index_is_id) if path is not None: f = open(path, mode) - ret = f if as_file else f.read() + try: + ret = f if as_file else f.read() + except IOError: + f.seek(0) + out = cStringIO.StringIO() + shutil.copyfileobj(f, out) + ret = out.getvalue() if not as_file: f.close() return ret diff --git a/src/calibre/library/server/content.py b/src/calibre/library/server/content.py index aeba8a3218..9e2f0cb2a2 100644 --- a/src/calibre/library/server/content.py +++ b/src/calibre/library/server/content.py @@ -123,8 +123,6 @@ class ContentServer(object): return self.static('index.html') - - # Actually get content from the database {{{ def get_cover(self, id, thumbnail=False): cover = self.db.cover(id, index_is_id=True, as_file=False)