From 1ac0a9b32c9f44a857909f421c11a150ced556c7 Mon Sep 17 00:00:00 2001 From: Brian Heartwood Date: Wed, 29 May 2024 21:54:15 -0700 Subject: [PATCH] splitting only if find_most_recent_file() returns something --- installer/client/cli/helper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installer/client/cli/helper.py b/installer/client/cli/helper.py index afde5ec..10d5520 100644 --- a/installer/client/cli/helper.py +++ b/installer/client/cli/helper.py @@ -60,7 +60,12 @@ class Session: def list_sessions(self): sessionlist = os.listdir(self.sessions_folder) - most_recent = self.find_most_recent_file().split("/")[-1] + most_recent = self.find_most_recent_file() + if most_recent: + most_recent = most_recent.split("/")[-1] + else: + print("no recent sessions found") + return for session in sessionlist: with open(os.path.join(self.sessions_folder, session), "r") as f: firstline = f.readline().strip()