diff --git a/hackertray/__init__.py b/hackertray/__init__.py index e0fbe62..78f92b5 100644 --- a/hackertray/__init__.py +++ b/hackertray/__init__.py @@ -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):