diff --git a/beets/util/artresizer.py b/beets/util/artresizer.py index e5117a6af..e58b356be 100644 --- a/beets/util/artresizer.py +++ b/beets/util/artresizer.py @@ -72,7 +72,7 @@ def pil_resize(maxwidth, path_in, path_out=None): im = Image.open(util.syspath(path_in)) size = maxwidth, maxwidth im.thumbnail(size, Image.ANTIALIAS) - im.save(path_out) + im.save(util.py3_path(path_out)) return path_out except IOError: log.error(u"PIL cannot create thumbnail for '{0}'", diff --git a/docs/changelog.rst b/docs/changelog.rst index 1b4f5f44e..b0e7a6cab 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -83,6 +83,9 @@ Fixes: * Improve error reporting: during startup if sqlite returns an error the sqlite error message is attached to the beets message. :bug:`3005` +* Fix a problem when resizing images with PIL/Pillow on Python 3. + Thanks to :user:`architek`. + :bug:`2504` :bug:`3029` .. _python-itunes: https://github.com/ocelma/python-itunes diff --git a/test/test_ui.py b/test/test_ui.py index 77804d3d2..b9039d236 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -800,16 +800,18 @@ class ConfigTest(unittest.TestCase, TestHelper, _common.Assertions): self.run_command('test', lib=None) replacements = self.test_cmd.lib.replacements - self.assertEqual(replacements, [(re.compile(u'[xy]'), 'z')]) + repls = [(p.pattern, s) for p, s in replacements] # Compare patterns. + self.assertEqual(repls, [(u'[xy]', 'z')]) def test_multiple_replacements_parsed(self): with self.write_config_file() as config: config.write("replace: {'[xy]': z, foo: bar}") self.run_command('test', lib=None) replacements = self.test_cmd.lib.replacements - self.assertEqual(replacements, [ - (re.compile(u'[xy]'), u'z'), - (re.compile(u'foo'), u'bar'), + repls = [(p.pattern, s) for p, s in replacements] + self.assertEqual(repls, [ + (u'[xy]', u'z'), + (u'foo', u'bar'), ]) def test_cli_config_option(self): diff --git a/tox.ini b/tox.ini index eb678369f..154cd7655 100644 --- a/tox.ini +++ b/tox.ini @@ -40,12 +40,12 @@ passenv = deps = {test,cov}: {[_test]deps} py27: pathlib - py{27,34,35,36}-flake8: {[_flake8]deps} + py{27,34,35,36,37}-flake8: {[_flake8]deps} commands = py27-cov: python -m nose --with-coverage {posargs} py27-test: python -m nose {posargs} - py{34,35}-cov: python -bb -m nose --with-coverage {posargs} - py{34,35,36}-test: python -bb -m nose {posargs} + py3{4,5,6,7}-cov: python -bb -m nose --with-coverage {posargs} + py3{4,5,6,7}-test: python -bb -m nose {posargs} py27-flake8: flake8 --min-version 2.7 {posargs} {[_flake8]files} py34-flake8: flake8 --min-version 3.4 {posargs} {[_flake8]files} py35-flake8: flake8 --min-version 3.5 {posargs} {[_flake8]files}