diff --git a/beetsplug/badfiles.py b/beetsplug/badfiles.py index 0be08bae5f..fdfbf204a1 100644 --- a/beetsplug/badfiles.py +++ b/beetsplug/badfiles.py @@ -66,7 +66,7 @@ def run_command(self, cmd): status = e.returncode except OSError as e: raise CheckerCommandException(cmd, e) - output = output.decode(sys.getfilesystemencoding()) + output = output.decode(sys.getdefaultencoding(), 'replace') return status, errors, [line for line in output.split("\n") if line] def check_mp3val(self, path): @@ -134,12 +134,12 @@ def check_item(self, item): ui.print_(u"{}: checker exited with status {}" .format(ui.colorize('text_error', dpath), status)) for line in output: - ui.print_(u" {}".format(displayable_path(line))) + ui.print_(u" {}".format(line)) elif errors > 0: ui.print_(u"{}: checker found {} errors or warnings" .format(ui.colorize('text_warning', dpath), errors)) for line in output: - ui.print_(u" {}".format(displayable_path(line))) + ui.print_(u" {}".format(line)) elif self.verbose: ui.print_(u"{}: ok".format(ui.colorize('text_success', dpath))) diff --git a/docs/changelog.rst b/docs/changelog.rst index 8e02c974ec..f311571d58 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -147,6 +147,9 @@ Fixes: Thanks to :user:`Holzhaus`. :bug:`1579` * Fetchart now respects the ``ignore`` and ``ignore_hidden`` settings. :bug:`1632` +* :doc:`/plugins/badfiles`: Avoid a crash when the underlying tool emits + undecodable output. + :bug:`3165` .. _python-itunes: https://github.com/ocelma/python-itunes