You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the code we have many of the file openning that are done in this model : outfile = open(outFilePath, 'w') #dataTime = dateutil.parser.parse(analyser.eventObj['dataTime']) pageData={ 'events': { 'tcSeizures': tcSeizuresLst, 'allSeizures': allSeizuresLst, 'falseAlarms': [], 'otherEvents': [] } } #print(pageData) print("Rendering index page") outfile.write(template.render(data=pageData)) outfile.close()
The problem is that if something is going bad between open and close, the file will never be closed properly.
Using either try except finally of with open(fname) as infile: to resolve that issue.
The text was updated successfully, but these errors were encountered:
pmithrandir
changed the title
Files open are almost never closed properly if an exception is raised.
Files open are not closed properly if an exception is raised in Summarize Data
Jan 12, 2024
In the code we have many of the file openning that are done in this model :
outfile = open(outFilePath, 'w') #dataTime = dateutil.parser.parse(analyser.eventObj['dataTime']) pageData={ 'events': { 'tcSeizures': tcSeizuresLst, 'allSeizures': allSeizuresLst, 'falseAlarms': [], 'otherEvents': [] } } #print(pageData) print("Rendering index page") outfile.write(template.render(data=pageData)) outfile.close()
The problem is that if something is going bad between open and close, the file will never be closed properly.
Using either try except finally of with open(fname) as infile: to resolve that issue.
The text was updated successfully, but these errors were encountered: