From f5f29d775ce83bbfadfcbcde4814945dddf4ed9f Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 3 May 2014 15:12:13 -0400 Subject: [PATCH] Adapt IPhotoPlistParser to Python 3.4 This also means that Python 3.3 isn't supported anymore for that part. Updated README accordingly. --- README.md | 2 +- core_pe/iphoto_plist.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 224a326f..9199421d 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Prerequisites are installed through `pip`. However, some of them are not "pip in to be installed manually. * All systems: [Python 3.3+][python] and [setuptools][setuptools] -* Mac OS X: The last XCode to have the 10.7 SDK included. +* Mac OS X: The last XCode to have the 10.7 SDK included. Python 3.4+. * Windows: Visual Studio 2010, [PyQt 5.0+][pyqt], [cx_Freeze][cxfreeze] and [Advanced Installer][advinst] (you only need the last two if you want to create an installer) diff --git a/core_pe/iphoto_plist.py b/core_pe/iphoto_plist.py index ee686f26..dd0a831f 100644 --- a/core_pe/iphoto_plist.py +++ b/core_pe/iphoto_plist.py @@ -8,24 +8,24 @@ import plistlib -class IPhotoPlistParser(plistlib.PlistParser): +class IPhotoPlistParser(plistlib._PlistParser): """A parser for iPhoto plists. iPhoto plists tend to be malformed, so we have to subclass the built-in parser to be a bit more lenient. """ def __init__(self): - plistlib.PlistParser.__init__(self) + plistlib._PlistParser.__init__(self, use_builtin_types=True, dict_type=dict) # For debugging purposes, we remember the last bit of data to be analyzed so that we can # log it in case of an exception self.lastdata = '' - def getData(self): - self.lastdata = plistlib.PlistParser.getData(self) + def get_data(self): + self.lastdata = plistlib._PlistParser.get_data(self) return self.lastdata def end_integer(self): try: - self.addObject(int(self.getData())) + self.add_object(int(self.get_data())) except ValueError: - self.addObject(0) + self.add_object(0)