From 175001db9e29c32a57dba9f8b3387f729d7f84a7 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Sat, 29 Jul 2006 20:20:52 +0000 Subject: [PATCH] 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. --- Lib/uuid.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/uuid.py b/Lib/uuid.py index b0afd945c1..a6446a16f9 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: -- 2.50.0