Codebase list sugar-read-activity / 6cb7edb
Avoid error if can't uncompress any file in a epub file Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org> Gonzalo Odiard 11 years ago
1 changed file(s) with 8 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
1919 import os
2020 import xml.etree.ElementTree as etree
2121 import shutil
22 import logging
2223
2324 import navmap
2425 import epubinfo
5657 for name in self._zobject.namelist():
5758 # Some weird zip file entries start with a slash,
5859 # and we don't want to write to the root directory
59 if name.startswith(os.path.sep):
60 name = name[1:]
61 if name.endswith(os.path.sep) or name.endswith('\\'):
62 os.makedirs(name)
60 try:
61 if name.startswith(os.path.sep):
62 name = name[1:]
63 if name.endswith(os.path.sep) or name.endswith('\\'):
64 os.makedirs(name)
65 except:
66 logging.error('ERROR unziping %s', name)
6367 else:
6468 self._zobject.extract(name)
6569 os.chdir(orig_cwd)