diff --git a/jc/parsers/pbPlist/pbPlist.py b/jc/parsers/pbPlist/pbPlist.py index 65293465..a503c136 100644 --- a/jc/parsers/pbPlist/pbPlist.py +++ b/jc/parsers/pbPlist/pbPlist.py @@ -36,13 +36,12 @@ class PBPlist(object): def __init__(self, file_path): self.root = None - # don't use __checkFile since we can only open the file once in Windows - # if self.__checkFile(file_path) is True: - self.file_path = file_path - parser = PBParser(self.file_path) - self.root = parser.read() - self.string_encoding = parser.string_encoding - self.file_type = parser.file_type + if self.__checkFile(file_path) is True: + self.file_path = file_path + parser = PBParser(self.file_path) + self.root = parser.read() + self.string_encoding = parser.string_encoding + self.file_type = parser.file_type def write(self, file_path=None): if file_path is None: diff --git a/jc/parsers/plist.py b/jc/parsers/plist.py index 83f203aa..a7858ccb 100644 --- a/jc/parsers/plist.py +++ b/jc/parsers/plist.py @@ -166,7 +166,7 @@ def parse( # Try parsing as an old-style NeXTSTEP Plist format # pbPlist library only works on file paths, not strings :( import tempfile - with tempfile.NamedTemporaryFile(mode='w+b') as plist_file: + with tempfile.NamedTemporaryFile(mode='w+b', delete=False) as plist_file: plist_file.write(data) plist_file.seek(0) parsed_plist = PBPlist(plist_file.name)