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