Catch an error from command line Python
<p>I need to catch an error from command line without print error message on the screen. When this occurs I need to give another command to run.</p>

<p>This is what I do now:</p>

<pre><code>hyst_cmd = "si viewhistory ..."
process = subprocess.Popen(hyst_cmd, stdout=subprocess.PIPE)
hyst = process.stdout.read().splitlines()
</code></pre>

<p>When I do this for some projects I receive an error message, on the screen.</p>

<p>Sorry for my english!</p>