Writing to SdtErr

Mike Peat mike at unicorn-fs.com
Mon Oct 22 10:22:07 EDT 2001


Thanks Michael - that did the biz on both counts!

Mike Peat

"Michael Hudson" <mwh at python.net> wrote in message
news:u8ze36bit.fsf at python.net...
> "Mike Peat" <mike at unicorn-fs.com> writes:
>
> > Can anyone tell me how to:
> >
> > 1) Turn of the Python "Traceback" output, or make it less verbose?
>
> sys.excepthook = something_else
>
> > 2) Write (print) to the StdErr channel instead of StdOut?
>
> print >> sys.stderr, "foo"
>
> Both of these require a new-ish Python (not sure which release,
> sorry).
>
> An example of both:
>
> >>> def eh(type, value, tb):
> ...     print >> sys.stderr, "Exception: ", type
> ...
> >>> sys.excepthook = eh
> >>> 1/0
> Exception:  exceptions.ZeroDivisionError
>
> Cheers,
> M.
>
> --
>   I have long since given up dealing with people who hold idiotic
>   opinions as if they had arrived at them through thinking about
>   them.                                 -- Erik Naggum, comp.lang.lisp





More information about the Python-list mailing list