slightly safer file closing strategy

This commit is contained in:
Philip Eisenlohr 2012-11-30 08:38:52 +00:00
parent 9fb838fd28
commit 74f62c891d
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ class extendableOption(Option):
# --------------------------------------------------------------------
parser = OptionParser(option_class=extendableOption, usage='%prog [file[s]]', description = """
Remove info from table head
Remove info lines from given ASCIItable(s).
""" + string.replace('$Id$','\n','\\n')
)
@ -68,7 +68,7 @@ for file in files:
outputAlive and table.output_flush() # just in case of buffered ASCII table
file['input'].close() # close input ASCII table
if file['name'] != 'STDIN':
file['input'].close() # close input ASCII table
file['output'].close() # close output ASCII table
os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new