Commit ac492887 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

utils.OwnIpAddress: Change try/except for Python 2.4



Python 2.4 doesn't support “except” and “finally” in the same block.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 2a7c3583
...@@ -1807,10 +1807,11 @@ def OwnIpAddress(address): ...@@ -1807,10 +1807,11 @@ def OwnIpAddress(address):
s = socket.socket(family, socket.SOCK_DGRAM) s = socket.socket(family, socket.SOCK_DGRAM)
success = False success = False
try: try:
s.bind((address, 0)) try:
success = True s.bind((address, 0))
except socket.error: success = True
success = False except socket.error:
success = False
finally: finally:
s.close() s.close()
return success return success
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment