Skip to content

Commit 95bc5dc

Browse files
authored
Use auto resource management for license file (#20)
1 parent 7251181 commit 95bc5dc

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

usr/lib/thingy/thingy.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,8 @@ def open_about(self, widget):
167167
dlg.set_program_name("thingy")
168168
dlg.set_comments(_("Library"))
169169
try:
170-
h = open('/usr/share/common-licenses/GPL', encoding="utf-8")
171-
s = h.readlines()
172-
gpl = ""
173-
for line in s:
174-
gpl += line
175-
h.close()
170+
with open('/usr/share/common-licenses/GPL', encoding="utf-8") as h:
171+
gpl = h.read()
176172
dlg.set_license(gpl)
177173
except Exception as e:
178174
print (e)

0 commit comments

Comments
 (0)