Added error checking.

Checked if the subprocess called returned an error (non zero returncode) or there was an error in calling the process (OSError).