Code review comment for lp://staging/~steve-mcintyre/linaro-chromiumos/error_checking

Revision history for this message
Loïc Minier (lool) wrote :

Remove the "print" before the exception throwing; you can either deal with the error in higher level logic, or print the exception message from the main script, or just let the exception go out to the default handler which will include the error message.

Usually in scripts people prefer the subprocess module rather than os.system() which is very limited; subprocess.Popen() is very flexible allowing you to do pipes or capture stdout / stderr for instance, and if you only need to run a command and throw an exception if it fails it provides a wrapper around Popen called check_call() which does that. There are other utilities to get command output as well.

I suggest you use check_call instead of os.system; this will allow closing stderr or stdout in the future when we deem sensible, or piping them to a log file etc.

« Back to merge proposal