Skip to content

Commit

Permalink
Fix deprecated plistlib function
Browse files Browse the repository at this point in the history
  • Loading branch information
arcresu committed Mar 31, 2019
1 parent e4c03fd commit a6305c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion beetsplug/metasync/itunes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import tempfile
import plistlib

import six
from six.moves.urllib.parse import urlparse, unquote
from time import mktime

Expand Down Expand Up @@ -84,7 +85,11 @@ def __init__(self, config, log):
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:
Expand Down

0 comments on commit a6305c3

Please sign in to comment.