From: Neal Norwitz Date: Sat, 29 Jul 2006 20:20:52 +0000 (+0000) Subject: If the executable doesn't exist, there's no reason to try to start it. X-Git-Tag: v2.5b3~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=175001db9e29c32a57dba9f8b3387f729d7f84a7;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/uuid.py b/Lib/uuid.py index b0afd945c104..a6446a16f9fc 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: