From 8d1007189f7024d796687e94dc461864288af8df Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 28 Feb 2014 08:46:05 -0500 Subject: Clean up ENOENT messages a bit --- lib/chutney/TorNet.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py index ec467a3..3685ec0 100644 --- a/lib/chutney/TorNet.py +++ b/lib/chutney/TorNet.py @@ -281,10 +281,10 @@ class LocalNodeBuilder(NodeBuilder): p = subprocess.Popen(cmdline, stdin=subprocess.PIPE) except OSError as e: # only catch file not found error - if errno.errorcode[e.errno] == 'ENOENT': - print ''.join(["Cannot find tor-gencert binary, use ", - "CHUTNEY_TOR_GENCERT environment variable to set the ", - "path or put the binary into $PATH."]) + if e.errno == errno.ENOENT: + print ("Cannot find tor-gencert binary %r. Use " + "CHUTNEY_TOR_GENCERT environment variable to set the " + "path, or put the binary into $PATH.")%tor_gencert sys.exit(0) else: raise @@ -310,10 +310,10 @@ class LocalNodeBuilder(NodeBuilder): p = subprocess.Popen(cmdline, stdout=subprocess.PIPE) except OSError as e: # only catch file not found error - if errno.errorcode[e.errno] == 'ENOENT': - print ''.join(["Cannot find tor-gencert binary, use ", - "CHUTNEY_TOR_GENCERT environment variable to set the ", - "path or put the binary into $PATH."]) + if e.errno == errno.ENOENT: + print ("Cannot find tor binary %r. Use " + "CHUTNEY_TOR environment variable to set the " + "path, or put the binary into $PATH.")%tor sys.exit(0) else: raise @@ -473,10 +473,10 @@ class LocalNodeController(NodeController): p = subprocess.Popen(cmdline) except OSError as e: # only catch file not found error - if errno.errorcode[e.errno] == 'ENOENT': - print ''.join(["Cannot find Tor binary, use CHUTNEY_TOR ", - "environment variable to set the path or put the binary ", - "into $PATH."]) + if e.errno == errno.ENOENT: + print ("Cannot find tor binary %r. Use CHUTNEY_TOR " + "environment variable to set the path, or put the binary " + "into $PATH.")%tor_path sys.exit(0) else: raise -- cgit v1.2.3