From 27d741cacc227325eb20c99250b1f326aed8cbb0 Mon Sep 17 00:00:00 2001 From: ATATC Date: Mon, 22 Apr 2024 14:26:23 -0400 Subject: [PATCH] Bug fixed: possible error when getting hostname. (#112) --- leads/comm/prototype.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/leads/comm/prototype.py b/leads/comm/prototype.py index b15a17dd..95b575c6 100644 --- a/leads/comm/prototype.py +++ b/leads/comm/prototype.py @@ -1,6 +1,6 @@ from abc import abstractmethod as _abstractmethod, ABCMeta as _ABCMeta from socket import socket as _socket, AF_INET as _AF_INET, SOCK_STREAM as _SOCK_STREAM, \ - gethostbyname_ex as _gethostbyname_ex, gethostname as _gethostname, gaierror as _gaierror + gethostbyname_ex as _gethostbyname_ex, gethostname as _gethostname, gaierror as _gaierror, herror as _herror from threading import Lock as _Lock, Thread as _Thread from typing import Self as _Self, Callable as _Callable, override as _override @@ -11,7 +11,7 @@ def my_ip_addresses() -> list[str]: try: return [ip for ip in _gethostbyname_ex(_gethostname())[2] if not ip.startswith("127.")] - except _gaierror: + except (_gaierror, _herror): return []