Python 3.9 compatibility
On Python 3.9 when calling biplist.readPlistFromString():
File ".tox/py39/lib/python3.9/site-packages/biplist/__init__.py", line 143, in readPlist
line: raise InvalidPlistException(e)
locals:
InvalidPlistException = <global> <class 'biplist.InvalidPlistException'>
e = <not found>
InvalidPlistException: module 'plistlib' has no attribute 'Data'
In Python 3.9:
The old plistlib
API has been removed, it was deprecated since Python 3.4. Use the load()
, loads()
, dump()
, and dumps()
functions. Additionally, the use_builtin_types parameter was removed, standard bytes
objects are always used instead. (Contributed by Jon Janzen in bpo-36409.)
https://docs.python.org/3.9/whatsnew/3.9.html#removed
Comments (6)
-
-
Or I might not. It seems plistlib might have grown support for binary formats.
-
repo owner Yeah, I would look into the plistlib binary plist support in 3.x. It seems to be, in my experience, pretty good in most use cases.
-
reporter Thanks for the pointer and the confirmation. I’ve checked and plistlib can run our binary test.
-
FWIW applying this patch in Debian to use bytes: https://salsa.debian.org/python-team/packages/python-biplist/-/blob/6be085e22add23d3c1917f8e2aedb39e566d005d/debian/patches/python3.9.patch
It’s obviously not backwards compatible all the way to Python 2.6, so maybe not the approach you want to take.
-
- attached plistlib-Data.patch
I don't think the Debian patch is correct.
o
can be legitimately of typebytes
, couldn’t it? - Log in to comment
Agreed, this is a problem for one of my projects (dmgbuild). I might try to take a look at fixing it.