[ttx] Close file before returning, to prevent ResourceWarnings in py3
This commit is contained in:
parent
4fce7a0b7b
commit
076e2ba33a
@ -285,12 +285,13 @@ def guessFileType(fileName):
|
|||||||
f = open(fileName, "rb")
|
f = open(fileName, "rb")
|
||||||
except IOError:
|
except IOError:
|
||||||
return None
|
return None
|
||||||
|
header = f.read(256).lstrip(b'\xef\xbb\xbf')
|
||||||
|
f.close()
|
||||||
cr, tp = getMacCreatorAndType(fileName)
|
cr, tp = getMacCreatorAndType(fileName)
|
||||||
if tp in ("sfnt", "FFIL"):
|
if tp in ("sfnt", "FFIL"):
|
||||||
return "TTF"
|
return "TTF"
|
||||||
if ext == ".dfont":
|
if ext == ".dfont":
|
||||||
return "TTF"
|
return "TTF"
|
||||||
header = f.read(256).lstrip(b'\xef\xbb\xbf')
|
|
||||||
head = Tag(header[:4])
|
head = Tag(header[:4])
|
||||||
if head == "OTTO":
|
if head == "OTTO":
|
||||||
return "OTF"
|
return "OTF"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user