From: W. Trevor King Date: Wed, 20 Jul 2011 16:52:54 +0000 (-0400) Subject: Adjust entrez.py to print the name of failing external commands. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=85753dfe2f01898542e6f4f000735b41ffd05d21;p=blog.git Adjust entrez.py to print the name of failing external commands. This provides a useful hint if someone forgot to install one of the dependencies. --- diff --git a/posts/entrez/entrez.py b/posts/entrez/entrez.py index 11356aa..b02a32c 100755 --- a/posts/entrez/entrez.py +++ b/posts/entrez/entrez.py @@ -150,10 +150,13 @@ class Pipe (object): kwargs = {} if _POSIX: kwargs['close_fds'] = True - self._procs.append(_subprocess.Popen( - cmd, stdin=stdin, stdout=_subprocess.PIPE, - stderr=_subprocess.PIPE, **kwargs)) - + try: + self._procs.append(_subprocess.Popen( + cmd, stdin=stdin, stdout=_subprocess.PIPE, + stderr=_subprocess.PIPE, **kwargs)) + except OSError: + LOG.error(cmd) + raise self.stdout,self.stderrs = self._communicate(input=stdin_str) # collect process statuses