From 1cc06c31634cb2a52e80d69730ec11e2ba2dffd2 Mon Sep 17 00:00:00 2001 From: hdulme Date: Sat, 27 Dec 2025 21:26:03 +0100 Subject: [PATCH] Use auto resource management for license file --- usr/lib/thingy/thingy.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/usr/lib/thingy/thingy.py b/usr/lib/thingy/thingy.py index 7a684b7..9f4cd68 100755 --- a/usr/lib/thingy/thingy.py +++ b/usr/lib/thingy/thingy.py @@ -167,12 +167,8 @@ def open_about(self, widget): dlg.set_program_name("thingy") dlg.set_comments(_("Library")) try: - h = open('/usr/share/common-licenses/GPL', encoding="utf-8") - s = h.readlines() - gpl = "" - for line in s: - gpl += line - h.close() + with open('/usr/share/common-licenses/GPL', encoding="utf-8") as h: + gpl = h.read() dlg.set_license(gpl) except Exception as e: print (e)