Merge pull request #14 from yasoob/patch-1

Makes sure data file closes smoothly using with.
This commit is contained in:
Nemo 2013-11-30 11:47:42 -08:00
commit 61451d4c3c
1 changed files with 2 additions and 2 deletions

View File

@ -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):