using with construct
using with construct so that the file closes smoothly
This commit is contained in:
parent
fa630d776e
commit
d02e78f639
|
@ -72,8 +72,8 @@ class HackerNewsApp:
|
|||
l=list(self.db)
|
||||
home = expanduser("~")
|
||||
#truncate the file
|
||||
file = open(home+'/.hackertray.json', 'w+')
|
||||
file.write(json.dumps(l))
|
||||
with open(home+'/.hackertray.json', 'w+') as file:
|
||||
file.write(json.dumps(l))
|
||||
gtk.main_quit()
|
||||
|
||||
def run(self):
|
||||
|
|
Loading…
Reference in New Issue