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)
|
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()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
Loading…
Reference in New Issue