Test sys.stderr to ensure it hasn't been overridden

Ensure sys.stderr is a regular file before trying to capture its output.  This should fix #15 and fix #16 running this under Apache+mod_wsgi.