[Python-checkins] r50954 - python/trunk/Lib/uuid.py
neal.norwitz
python-checkins at python.org
Sat Jul 29 22:20:52 CEST 2006
Author: neal.norwitz
Date: Sat Jul 29 22:20:52 2006
New Revision: 50954
Modified:
python/trunk/Lib/uuid.py
Log:
If the executable doesn't exist, there's no reason to try to start it.
This prevents garbage about command not found being printed on Solaris.
Modified: python/trunk/Lib/uuid.py
==============================================================================
--- python/trunk/Lib/uuid.py (original)
+++ python/trunk/Lib/uuid.py Sat Jul 29 22:20:52 2006
@@ -274,10 +274,13 @@
def _find_mac(command, args, hw_identifiers, get_index):
import os
for dir in ['', '/sbin/', '/usr/sbin']:
+ executable = os.path.join(dir, command)
+ if not os.path.exists(executable):
+ continue
+
try:
# LC_ALL to get English output, 2>/dev/null to
# prevent output on stderr
- executable = os.path.join(dir, command)
cmd = 'LC_ALL=C %s %s 2>/dev/null' % (executable, args)
pipe = os.popen(cmd)
except IOError:
More information about the Python-checkins
mailing list