title: When to use sys.stdout instead of sys.stderr?
body: <p>My boss told me to look at some old code where everything is being sent to stderr. I know that stderr should have the warnings and errors, but when should they really should go to stdout instead?</p>
  
  <p>This program is a service.  Some of the messages that it sends to stderr are:</p>
  
  <pre><code>if pid is None:
      message = "pidfile {0} is not running. \n"
      sys.stderr.write(message.format(self.pidfile))
  </code></pre>
  
  <p>So this one is an output, right? A message about being successful or not should go to stdout, because it's not an error?</p>
  
  <p>And then I got another one that is an exception:</p>
  
  <pre><code>except OSError as err:
      sys.stderr.write('fork #1 failed: {0}\n'.format(err))
      sys.exit(1)
  </code></pre>
  
  <p>This one as an exception, so it should go to stderr, because it's an error? Or should it go to stdout, because it is a output message just saying that the program failed?</p>
  
  <p>I know what stdout and stderr are --- I read quite a bit before asking. My problem here is being able to identify <em>which</em> messages should go to stderr --- just fatal errors, or any kind of error message?</p>
  
  <p>Both the examples are error messages, but one is just a "Program is not running". I'm having trouble choosing where that kind of message should be sent.</p>