diff --git a/kindlecomicconverter/comicarchive.py b/kindlecomicconverter/comicarchive.py index 683f1bb..d6d7180 100644 --- a/kindlecomicconverter/comicarchive.py +++ b/kindlecomicconverter/comicarchive.py @@ -52,9 +52,7 @@ class ComicArchive: for line in process.stdout.splitlines(): if b'Type =' in line: return line.rstrip().decode().split(' = ')[1].upper() - except FileNotFoundError: - pass - except CalledProcessError: + except (FileNotFoundError, CalledProcessError): pass raise OSError(EXTRACTION_ERROR) @@ -67,7 +65,6 @@ class ComicArchive: ['tar', '-xf', self.filepath, '-C', targetdir], ['7z', 'x', '-y', '-xr!__MACOSX', '-xr!.DS_Store', '-xr!thumbs.db', '-xr!Thumbs.db', '-o' + targetdir, self.filepath], ] - missing = [] if distro.id() == 'fedora': extraction_commands.append( @@ -78,15 +75,10 @@ class ComicArchive: try: subprocess_run(cmd, capture_output=True, check=True) return targetdir - except FileNotFoundError: - missing.append(cmd[0]) - except CalledProcessError: + except (FileNotFoundError, CalledProcessError): pass - - if missing: - raise OSError(f'Extraction failed, try downloading {missing}') - else: - raise OSError(EXTRACTION_ERROR) + + raise OSError(EXTRACTION_ERROR) def addFile(self, sourcefile): if self.type in ['RAR', 'RAR5']: