I'm trying to parse through a massive file for an iTunes library and I'm attempting to use plistlib library, my code looks something like this:
import plistlib
with open('iTunes Music Library.xml') as fp:
pl = plistlib.load(fp)
print(pl["aKey"])
As I do so, I get the error 'TypeError: startswith first arg must be str or a tuple of str, not bytes'. I'm not sure what this is, any explanations?
prints, and it's 2018, he's more likely to be using 3.x. - abarnertplistlibhas added a lot of overhead over Expat, and also a lot of brittleness, so using it to parse iTunes library files is they're actually massive (as in hundreds of MB) was not really doable; you had to build something on top of, e.g,etreeinstead. I haven't really tried it with the new 3.4+plistlibimplementation, so maybe everything will work great… but keep your fingers crossed. - abarnert