catching errors in embedded Python on Windows
David Bolen
db3l at fitlinxx.com
Fri Aug 24 03:12:05 EDT 2001
(following up on my own post)
David Bolen <db3l at fitlinxx.com> writes:
> 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?
Whoops - my 1.5.2 source tree wasn't as pristine as I thought and I
was looking at a modified winmain.c with some old proposed changes to
make os.popen work in a console-less application.
That means the default pythonw.exe under 1.5.2 doesn't have any such
code, and you did say your application worked fine under pythonw,
right? Since pythonw basically runs Py_Initialize and then runs your
script through PyRun_SimpleFile, I'd really expect it to be similar
when embedded.
So stepping back a moment - your original question was differences in
catching sys.stdout/sys.stderr when embedded but any direct use of
stdout/stderr in pythonrun wouldn't get rerouted by any redirection of
sys.stdout/sys.stderr anyway. Just for the heck of it, if you try the
approach I suggested in the first response, do you still miss the
output?
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list