From a6305c36e111ffb4a3dcc17ee0f4baf7ab28be8d Mon Sep 17 00:00:00 2001 From: Carl Suster Date: Sun, 31 Mar 2019 19:53:17 +1100 Subject: [PATCH] Fix deprecated plistlib function https://docs.python.org/3.7/library/plistlib.html#plistlib.readPlist --- beetsplug/metasync/itunes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beetsplug/metasync/itunes.py b/beetsplug/metasync/itunes.py index 17ab1637f..d594fa591 100644 --- a/beetsplug/metasync/itunes.py +++ b/beetsplug/metasync/itunes.py @@ -24,6 +24,7 @@ import shutil import tempfile import plistlib +import six from six.moves.urllib.parse import urlparse, unquote from time import mktime @@ -84,7 +85,11 @@ class Itunes(MetaSource): self._log.debug( u'loading iTunes library from {0}'.format(library_path)) with create_temporary_copy(library_path) as library_copy: - raw_library = plistlib.readPlist(library_copy) + if six.PY2: + raw_library = plistlib.readPlist(library_copy) + else: + with open(library_copy, 'rb') as library_copy_f: + raw_library = plistlib.load(library_copy_f) except IOError as e: raise ConfigValueError(u'invalid iTunes library: ' + e.strerror) except Exception: