diff --git a/pilot/util/tracereport.py b/pilot/util/tracereport.py index d6b25ca5..b3607be4 100644 --- a/pilot/util/tracereport.py +++ b/pilot/util/tracereport.py @@ -114,7 +114,7 @@ def init(self, job): try: hostname = os.environ.get('PANDA_HOSTNAME', socket.gethostname()) - except socket.herror as exc: + except (socket.gaierror, socket.herror) as exc: logger.warning(f'unable to detect hostname for trace report: {exc}') hostname = os.environ.get('PANDA_HOSTNAME', 'unknown') @@ -126,7 +126,7 @@ def init(self, job): try: self['ip'] = socket.gethostbyname(hostname) - except socket.herror as exc: + except (socket.gaierror, socket.herror) as exc: logger.debug(f"unable to detect host IP for trace report: {exc}") self['ip'] = '0.0.0.0'