Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/epubview
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-09-14 21:51:02 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-09-26 15:53:04 (GMT)
commit6cb7edbfc0c317065d07241022ee62de698da3fa (patch)
tree63e5eb6e05c6c4ed1d68e29b3904cf227a14f4a9 /epubview
parent06ac61b8317dd44f0eb63855b5d81d21b22d3906 (diff)
Avoid error if can't uncompress any file in a epub file
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'epubview')
-rw-r--r--epubview/epub.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/epubview/epub.py b/epubview/epub.py
index dfc35f4..762b5b9 100644
--- a/epubview/epub.py
+++ b/epubview/epub.py
@@ -20,6 +20,7 @@ import tempfile
import os
import xml.etree.ElementTree as etree
import shutil
+import logging
import navmap
import epubinfo
@@ -57,10 +58,13 @@ class _Epub(object):
for name in self._zobject.namelist():
# Some weird zip file entries start with a slash,
# and we don't want to write to the root directory
- if name.startswith(os.path.sep):
- name = name[1:]
- if name.endswith(os.path.sep) or name.endswith('\\'):
- os.makedirs(name)
+ try:
+ if name.startswith(os.path.sep):
+ name = name[1:]
+ if name.endswith(os.path.sep) or name.endswith('\\'):
+ os.makedirs(name)
+ except:
+ logging.error('ERROR unziping %s', name)
else:
self._zobject.extract(name)
os.chdir(orig_cwd)