diff --git a/beets/importer.py b/beets/importer.py index 4e4084eec..889f1297e 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -1059,9 +1059,9 @@ class ArchiveImportTask(SentinelImportTask): if path_test(util.py3_path(self.toppath)): break + extract_to = mkdtemp() + archive = handler_class(util.py3_path(self.toppath), mode='r') try: - extract_to = mkdtemp() - archive = handler_class(util.py3_path(self.toppath), mode='r') archive.extractall(extract_to) finally: archive.close() diff --git a/docs/changelog.rst b/docs/changelog.rst index b0e7a6cab..2d456ae88 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -86,6 +86,8 @@ Fixes: * Fix a problem when resizing images with PIL/Pillow on Python 3. Thanks to :user:`architek`. :bug:`2504` :bug:`3029` +* Avoid a crash when archive extraction fails during import. + :bug:`3041` .. _python-itunes: https://github.com/ocelma/python-itunes