Third party script debugging on remote server ...

Graham Dumpleton Graham.Dumpleton at gmail.com
Thu Apr 19 01:50:41 EDT 2007


> Hi Graeme,
>
> Thanks for the suggestion. Unluckily for me, it doesn't seem to be
> working though ...
>
> I've tried it a number of different ways. I guess if I put the code
> after an exception, then the code won't be called.
> So I ran an error in the python script and then I called the
> sys.stderr.flush() from the python shell. No luck though.
>
> I called on it's own, still no luck,
>
> Then I tried ...
>
>     try:
>
>         raise Exception('Please log this error')
>
>     except:
>
>         import sys
>
>         sys.stderr.flush()
>         sys.stdout.flush()
>
> The error log still has no error info in it :-(  ....
>
> Is this problem unique to me ?

Those calls don't generate output themselves and exception details
don't get output at the point of a try/except block. If you want to
generate to Apache error log details of exception from try/except,
use:

  import traceback
  import sys

  try:
     xxx
  except:
     traceback.print_exc()
     sys.stderr.flush()

Using these flush functions from interactive debugger isn't going to
show you anything as this trick is only needed with mod_python. All
the functions do is force the output of any buffered data that was
written out previously.

Graham




More information about the Python-list mailing list