From 904baa6bc1b517033ebc3979aca0d1b3424c0f63 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 24 Aug 2014 10:07:25 -0700 Subject: [PATCH] Debug log for unreadable state files (#913) --- beets/importer.py | 7 ++++++- docs/changelog.rst | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/beets/importer.py b/beets/importer.py index ba534b0ea..bf0cf7f4e 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -65,7 +65,12 @@ def _open_state(): try: with open(config['statefile'].as_filename()) as f: return pickle.load(f) - except: + except Exception as exc: + # The `pickle` module can emit all sorts of exceptions during + # unpickling, including ImportError. We use a catch-all + # exception to avoid enumerating them all (the docs don't even have a + # full list!). + log.debug(u'state file could not be read: {0}'.format(exc)) return {} diff --git a/docs/changelog.rst b/docs/changelog.rst index 49c7ef5a3..8368bb681 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,7 @@ Fixes: * The :doc:`/plugins/lyrics` only strips featured artists and parenthesized title suffixes if no lyrics for the original artist and title were found. +* Fix a crash when reading some files with missing tags. 1.3.7 (August 22, 2014)