Merge pull request #14 from yasoob/patch-1
Makes sure data file closes smoothly using with.
This commit is contained in:
commit
61451d4c3c
|
@ -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