1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

create NamedTemporaryFile with delete=False for Windows compatibilty

This commit is contained in:
Kelly Brazil
2022-12-30 11:17:52 -08:00
parent 47d8e163de
commit 177d10577f
2 changed files with 7 additions and 8 deletions

View File

@ -36,8 +36,7 @@ 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:
if self.__checkFile(file_path) is True:
self.file_path = file_path
parser = PBParser(self.file_path)
self.root = parser.read()

View File

@ -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)