Catching Errors

Emile van Sebille emile at fenx.com
Fri Jun 8 17:00:24 CEST 2001


If you want to capture error output to a file, you can also try:

c:\> python errors-catch.py 2>errors.txt

--

Emile van Sebille
emile at fenx.com

---------
"mixo" <mixo77 at usa.net> wrote in message news:3B20E042.DA0AF3C1 at usa.net...
>
> How can I  catch errors that I are usually written to standard output?
> For example , say I have an error in my code, I  would like to to have
> the ouput written to a file.. The following  is what is written to
> standard output :
> -------------------------------------------------
>   Traceback (innermost last):
>   File "errors-catch.py", line 24, in ?
>     print "hello world!  s" %test
> TypeError: not all arguments converted
> -----------------------------------------------
> due to the error in the statement :
>     print "hello world!  s" %test # "s" should be "%s"
>
> The idea is, I want to simply write it (the error )to a file !
> (and I would n't mind as well  knowing what the errors is-
> even if its just an error  code)
>
>





More information about the Python-list mailing list