aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_format.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_format.py b/src/vpp-api/python/vpp_papi/vpp_format.py
index 2c2345a3f76..415070c4196 100644
--- a/src/vpp-api/python/vpp_papi/vpp_format.py
+++ b/src/vpp-api/python/vpp_papi/vpp_format.py
@@ -36,7 +36,9 @@ def format_vl_api_address_t(args):
try:
return {'un': {'ip6': inet_pton(AF_INET6, args)},
'af': ADDRESS_IP6}
- except socket.error as e:
+ # PY2: raises socket.error
+ # PY3: raises OSError
+ except (socket.error, OSError):
return {'un': {'ip4': inet_pton(AF_INET, args)},
'af': ADDRESS_IP4}