From 03d94d7f44b4e57a19827167c3da91e1be48e7f9 Mon Sep 17 00:00:00 2001 From: Scott King Date: Fri, 17 Nov 2023 10:58:27 -0700 Subject: [PATCH] use `with open()` so the file actually gets closed --- cli/cyberPanel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index 45dd7b153..0e3c51f8b 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -120,8 +120,8 @@ class cyberPanel: websites = Websites.objects.all() ipFile = "/etc/cyberpanel/machineIP" - f = open(ipFile) - ipData = f.read() + with open(ipFile, 'r') as f: + ipData = f.read() ipAddress = ipData.split('\n', 1)[0] json_data = []