pp icon indicating copy to clipboard operation
pp copied to clipboard

DeprecationWarning: The readPlist function is deprecated

Open renato0584 opened this issue 6 years ago • 2 comments

The code presents the following error:

anatomyPlaylist.py:16: DeprecationWarning: The readPlist function is deprecated, use load() instead plist = plistlib.readPlist(fileName) Traceback (most recent call last): File "anatomyPlaylist.py", line 162, in main() File "anatomyPlaylist.py", line 149, in main findCommonTracks(args.plFiles) File "anatomyPlaylist.py", line 16, in findCommonTracks plist = plistlib.readPlist(fileName) File "C:\Users\ext.renatoss1\AppData\Local\Programs\Python\Python37-32\lib\plistlib.py", line 100, in readPlist return load(fp, fmt=None, use_builtin_types=False) File "C:\Users\ext.renatoss1\AppData\Local\Programs\Python\Python37-32\lib\plistlib.py", line 944, in load raise InvalidFileException() plistlib.InvalidFileException: Invalid file

I've changed the line:

plist = plistlib.readPlist(fileName)

to

plist = np.load(fileName)

but, the error changed to:

Traceback (most recent call last): File "C:\Users\ext.renatoss1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\numpy\lib\npyio.py", line 440, in load return pickle.load(fid, **pickle_kwargs)_pickle.UnpicklingError: invalid load key, '\x0a'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "anatomyPlaylist.py", line 162, in main() File "anatomyPlaylist.py", line 149, in main findCommonTracks(args.plFiles) File "anatomyPlaylist.py", line 16, in findCommonTracks plist = np.load(fileName) File "C:\Users\ext.renatoss1\AppData\Local\Programs\Python\Python37-32\lib\sit e-packages\numpy\lib\npyio.py", line 443, in load "Failed to interpret file %s as a pickle" % repr(file)) OSError: Failed to interpret file 'maya.xml' as a pickle

Of course there is some other modification to make, but I can't figure it out yet.

Advices?

Thanks and sorry for my poor english.

renato0584 avatar Aug 29 '18 16:08 renato0584

with open(filename,'rb') as fp: pl=plistlib.load(fp)

kanzhong avatar Jun 03 '19 15:06 kanzhong

Submitted PR #22 to accommodate this.

rsersh avatar Oct 26 '19 01:10 rsersh