diff --git a/requirements.txt b/requirements.txt index 1fd4e9ea4..61eee5038 100644 --- a/requirements.txt +++ b/requirements.txt @@ -39,6 +39,7 @@ psutil # procmgr numpy # npy pandas hdf5 arrow tomli; python_version < '3.11' # toml pyconll # conll/conllu +backports.zoneinfo; python_version < '3.9' #f5log requests_cache # scraper beautifulsoup4 # scraper diff --git a/visidata/loaders/f5log.py b/visidata/loaders/f5log.py index 5f5fb9be8..079dbf840 100644 --- a/visidata/loaders/f5log.py +++ b/visidata/loaders/f5log.py @@ -4,10 +4,6 @@ from datetime import datetime, timedelta from ipaddress import ip_address -try: - import zoneinfo -except ImportError: - from backports import zoneinfo import re import traceback from typing import Any, Dict, Optional @@ -1043,6 +1039,10 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # the default F5 logs don't have the year so we have to guess from the file ctime # TODO: make this overridable + try: + import zoneinfo + except ImportError: + from backports import zoneinfo self._log_tz = zoneinfo.ZoneInfo("UTC") try: self._year = int(