[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")
|
||||
except IOError:
|
||||
return None
|
||||
header = f.read(256).lstrip(b'\xef\xbb\xbf')
|
||||
f.close()
|
||||
cr, tp = getMacCreatorAndType(fileName)
|
||||
if tp in ("sfnt", "FFIL"):
|
||||
return "TTF"
|
||||
if ext == ".dfont":
|
||||
return "TTF"
|
||||
header = f.read(256).lstrip(b'\xef\xbb\xbf')
|
||||
head = Tag(header[:4])
|
||||
if head == "OTTO":
|
||||
return "OTF"
|
||||
|
Loading…
x
Reference in New Issue
Block a user