From 50b0b602279fc0eb8d2bb9cab1d235197df72ec6 Mon Sep 17 00:00:00 2001 From: Takashi Natsume Date: Sun, 29 Sep 2024 21:28:47 +0900 Subject: [PATCH] Replace deprecated datetime.utcnow() The datetime.utcnow() is deprecated in Python 3.12. Replace datetime.utcnow() with datetime.now(datetime.timezone.utc).replace(tzinfo=None). Change-Id: I9bf6f69d9e174d490bb4f3eaef3b364ddf97a954 Signed-off-by: Takashi Natsume --- tools/outfilter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/outfilter.py b/tools/outfilter.py index e910f79ff2..55f9ee1487 100644 --- a/tools/outfilter.py +++ b/tools/outfilter.py @@ -76,7 +76,8 @@ def main(): # with zuulv3 native jobs and ansible capture it may become # clearer what to do if HAS_DATE.search(line) is None: - now = datetime.datetime.utcnow() + now = datetime.datetime.now(datetime.timezone.utc).replace( + tzinfo=None) ts_line = ("%s | %s" % ( now.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3], line))