summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-29 20:20:52 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-29 20:20:52 (GMT)
commit175001db9e29c32a57dba9f8b3387f729d7f84a7 (patch)
tree1d24820d223c4fb8990aa070831fbc24015f75b2 /Lib
parentabd51a358561b52d4d9ddc75b82b9749a3aba55a (diff)
downloadcpython-175001db9e29c32a57dba9f8b3387f729d7f84a7.zip
cpython-175001db9e29c32a57dba9f8b3387f729d7f84a7.tar.gz
cpython-175001db9e29c32a57dba9f8b3387f729d7f84a7.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/uuid.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py
index b0afd94..a6446a1 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -274,10 +274,13 @@ class UUID(object):
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: