mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
create NamedTemporaryFile with delete=False for Windows compatibilty
This commit is contained in:
@ -36,13 +36,12 @@ class PBPlist(object):
|
|||||||
|
|
||||||
def __init__(self, file_path):
|
def __init__(self, file_path):
|
||||||
self.root = None
|
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
|
||||||
self.file_path = file_path
|
parser = PBParser(self.file_path)
|
||||||
parser = PBParser(self.file_path)
|
self.root = parser.read()
|
||||||
self.root = parser.read()
|
self.string_encoding = parser.string_encoding
|
||||||
self.string_encoding = parser.string_encoding
|
self.file_type = parser.file_type
|
||||||
self.file_type = parser.file_type
|
|
||||||
|
|
||||||
def write(self, file_path=None):
|
def write(self, file_path=None):
|
||||||
if file_path is None:
|
if file_path is None:
|
||||||
|
@ -166,7 +166,7 @@ def parse(
|
|||||||
# Try parsing as an old-style NeXTSTEP Plist format
|
# Try parsing as an old-style NeXTSTEP Plist format
|
||||||
# pbPlist library only works on file paths, not strings :(
|
# pbPlist library only works on file paths, not strings :(
|
||||||
import tempfile
|
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.write(data)
|
||||||
plist_file.seek(0)
|
plist_file.seek(0)
|
||||||
parsed_plist = PBPlist(plist_file.name)
|
parsed_plist = PBPlist(plist_file.name)
|
||||||
|
Reference in New Issue
Block a user