Fontlab Script not Terminating

Ken Krugh's picture

I have this small Python script that, for some reason, won't seem to terminate. The 2nd file that it's writing does not complete unless I click the "Reset macro system" button on the macro palette.

Any ideas?

Thanks,
Ken

BearLeft = fl.glyph.GetBoundingRect().x
BearRight = fl.glyph.width - fl.glyph.GetBoundingRect().ur.x
if BearLeft >= 0 and BearRight >= 0:
print "This glyph does not have a negative bearing."
else:
finame=str("C:\Program Files\FontLab\Studio5\Macros\Bearings Fix Old Left.txt")
TheFile = open(finame, "w")
TheFile.write(str(BearLeft))
TheFile.close
finame=str("C:\Program Files\FontLab\Studio5\Macros\Bearings Fix Old Right.txt")
TheFile = open(finame, "w")
TheFile.write(str(BearRight))
TheFile.close

eigi's picture

You have to write

TheFile.close()

(with parentheses) in order to execute the close method of the file object.

Eigi

Ken Krugh's picture

Yep, that fixed it! Thanks yet again!

Ken

Syndicate content Syndicate content