From 2292db10fce04fcca3efb806f9a578ad38166e18 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 12 Jan 2020 07:45:16 +0100 Subject: Catch URLError when accessing network. --- dlpcvp.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlpcvp.py b/dlpcvp.py index 1802d0a..39cfcfc 100755 --- a/dlpcvp.py +++ b/dlpcvp.py @@ -11,7 +11,7 @@ import urllib.request import xml.etree.ElementTree as ET from distutils.version import LooseVersion from typing import Iterable, List, Optional, Tuple, Union -from urllib.error import HTTPError +from urllib.error import URLError, HTTPError from urllib.request import Request, urlopen # PyPI API documentation https://warehouse.readthedocs.io/api-reference/ @@ -303,6 +303,11 @@ def main(prj): except RuntimeError as ex: log.warning(f'Package {pkg} cannot be found: {ex}') continue + except URLError as ex: + log.warning( + 'Investigation of package %s caused network error: %s', + pkg, ex) + continue try: if pypi_ver > suse_ver: -- cgit