catching errors in embedded Python on Windows

David Bolen db3l at
Fri Aug 24 08:59:30 CEST 2001

Howard Lightstone <howard at> writes:

> (sample spots of stdout/stderr reference in pythonrun.c)

I think I understand better - I noticed those references (although
many are in the 1.5.2 source, but not in the latest 2.2 source - which
is the other one I have currently on my system - so you might always
try using a later version if possible), but figured they were on
pretty low level failure paths and shouldn't be a problem.

However, you're saying that the handles are simply invalid even to be
used in calls (which is true for a console-less application).  In my
previous post my embedding application was still console based, so I
wouldn't have run into this.

Have you tried looking at the PC/WinMain.c file, which is how pythonw
is built.  It has some code to specifically open handles 0, 1 and 2.
So if your code runs properly under pythonw, perhaps adding some
similar startup code to your embedding environment would permit the
same behavior?

-- David
 \               David Bolen            \   E-mail: db3l at  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \

More information about the Python-list mailing list