catching errors in embedded Python on Windows

Howard Lightstone howard at eegsoftware.com
Fri Aug 24 14:39:21 EDT 2001


Fixed....sort of.

Since I wanted to capture both stderr and stdout, Mark's exception method
wouldn't work for me.  In my C main initialization, I pre-imported my
DebugWin class and redefined sys.stderr and sys.stdout.  It seems that DOES
work if it all finishes ok before I try loading/running a separate file.

I'll post the next problem separately.....now I get failures trying to
import win32api (of course I AM in a debug state and they are not...).

Thanks for the ideas.

Howard

Howard Lightstone wrote:

> OK, I made up a Python class/methods to take over stderr/stdout when
> running Pythonw applications and display them in a Tkinter window.
> Works slick.
>
> However, this DOESN'T work when embedding Python since pythonrun.c still
> refers to stdout/stderr directly...which Windows doesn't have set to
> anything useful.
>
> How does one reroute/catch these errors?  Unfortunately, the only thing
> I can think of  involves changing pythonrun.c to use the 'objects'
> attached to sys.stdout and sys.stderr so they COULD be rerouted.
>
> It seems to me someone on this list commented on catching these embedded
> errors but I can't seem to find it.
>
> Any help?
>
> Thanks




More information about the Python-list mailing list