From 51e4520826f85c4ee241a39540b221254a1b32e0 Mon Sep 17 00:00:00 2001 From: Christopher Usher Date: Tue, 22 Oct 2019 00:01:35 +0100 Subject: [PATCH] replaced warnings.warn with logger.warn --- common/common/segments.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/common/segments.py b/common/common/segments.py index d7d9ccf..06515d5 100644 --- a/common/common/segments.py +++ b/common/common/segments.py @@ -11,7 +11,6 @@ import logging import os import shutil import sys -import warnings from collections import namedtuple from contextlib import closing @@ -229,7 +228,8 @@ def best_segments_by_start(hour): try: parsed.append(parse_segment_path(os.path.join(hour, name))) except ValueError as e: - warnings.warn(e) + logging.warning("Failed to parse segment {!r}".format(os.path.join(hour, name)), exc_info=True) + for start_time, segments in itertools.groupby(parsed, key=lambda segment: segment.start): # ignore temp segments as they might go away by the time we want to use them segments = [segment for segment in segments if segment.type != "temp"]