From 38fee299115b5966fee4703cfdf1d333181910c4 Mon Sep 17 00:00:00 2001 From: hduelme Date: Tue, 7 Jan 2025 23:50:38 +0100 Subject: [PATCH] Use auto resource management for license file --- usr/lib/webapp-manager/webapp-manager.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/usr/lib/webapp-manager/webapp-manager.py b/usr/lib/webapp-manager/webapp-manager.py index fa403bf..60202e2 100755 --- a/usr/lib/webapp-manager/webapp-manager.py +++ b/usr/lib/webapp-manager/webapp-manager.py @@ -238,12 +238,8 @@ def open_about(self, widget): dlg.set_program_name(_("Web Apps")) dlg.set_comments(_("Run websites as if they were apps")) 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)