summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/uuid.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py
index df51464..5684ad7 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -373,10 +373,13 @@ def _ipconfig_getnode():
pipe = os.popen(os.path.join(dir, 'ipconfig') + ' /all')
except IOError:
continue
- for line in pipe:
- value = line.split(':')[-1].strip().lower()
- if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):
- return int(value.replace('-', ''), 16)
+ else:
+ for line in pipe:
+ value = line.split(':')[-1].strip().lower()
+ if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):
+ return int(value.replace('-', ''), 16)
+ finally:
+ pipe.close()
def _netbios_getnode():
"""Get the hardware address on Windows using NetBIOS calls.