From c63a92bdec8043ec883ae8afc57ecf1670325d70 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Oct 2023 17:10:40 +0200 Subject: [PATCH] directnotify: Fix RotatingLog filePath error when sizeLimit is None --- direct/src/directnotify/RotatingLog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/direct/src/directnotify/RotatingLog.py b/direct/src/directnotify/RotatingLog.py index ad4bd346db..e47b60cee6 100755 --- a/direct/src/directnotify/RotatingLog.py +++ b/direct/src/directnotify/RotatingLog.py @@ -55,10 +55,11 @@ class RotatingLog: return 0 def filePath(self): - dateString=time.strftime("%Y_%m_%d_%H", time.localtime()) + dateString = time.strftime("%Y_%m_%d_%H", time.localtime()) for i in range(26): - path="%s_%s_%s.log"%(self.path, dateString, chr(i+97)) - if not os.path.exists(path) or os.stat(path)[6] < self.sizeLimit: + limit = self.sizeLimit + path = "%s_%s_%s.log" % (self.path, dateString, chr(i+97)) + if limit is None not os.path.exists(path) or os.stat(path)[6] < limit: return path # Hmm, 26 files are full? throw the rest in z: # Maybe we should clear the self.sizeLimit here... maybe.