Skip to content

Commit 0216ef2

Browse files
committed
badfiles: Python 3 compatibility
Discovered while working on beetbox#2428 that we were using an implicit bytes-to-str conversion on the extension. This broke dict lookup on Python 3.
1 parent 0131ce2 commit 0216ef2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

beetsplug/badfiles.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def check_bad(self, lib, opts, args):
9494
ui.colorize('text_error', dpath)))
9595

9696
# Run the checker against the file if one is found
97-
ext = os.path.splitext(item.path)[1][1:]
97+
ext = os.path.splitext(item.path)[1][1:].decode('utf8', 'ignore')
9898
checker = self.get_checker(ext)
9999
if not checker:
100100
self._log.debug(u"no checker available for {}", ext)

docs/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Fixes:
3232
* :doc:`/plugins/mpdstats`: Fix Python 3 compatibility. The plugin also now
3333
requires version 0.4.2 or later of the ``python-mpd2`` library. :bug:`2405`
3434
* :doc:`/plugins/mpdstats`: Improve handling of mpd status queries.
35+
* :doc:`/plugins/badfiles`: Fix Python 3 compatibility.
3536

3637

3738
1.4.3 (January 9, 2017)

0 commit comments

Comments
 (0)