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
19 | 19 | import os |
20 | 20 | import xml.etree.ElementTree as etree |
21 | 21 | import shutil |
22 | import logging | |
22 | 23 | |
23 | 24 | import navmap |
24 | 25 | import epubinfo |
56 | 57 | for name in self._zobject.namelist(): |
57 | 58 | # Some weird zip file entries start with a slash, |
58 | 59 | # 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) | |
63 | 67 | else: |
64 | 68 | self._zobject.extract(name) |
65 | 69 | os.chdir(orig_cwd) |