embedded: redirecting stdout before you call Py_Initialize

Warren Postma embed at geocities.com
Fri Mar 3 15:12:38 CET 2000


>
> I may be off base, but I did not think Py_Initialize wrote anything to
> stderr at all. You have to make it print out using PyErr_Print. You
> can redirect before that call.
>
> What am I missing?

There are two errors that go straight to stdout [or stderr, actually].
First, is if there is an error reading Lib\site.py, and secondly if there is
an error reading Lib\exceptions.py, noting that the system is falling back
to string based exceptions. Since my system doesn't support a true local
console [it's a headless embedded system] those messages are lost forever,
and can become a time consuming ordeal figuring out later what went wrong
when the errors could be diagnosed easier if the output was captured and
redirected.  The other alternative [which I am now seriously considering] is
specifically hacking the Python initialization code to not write errors out
to stdout or stderr.

Warren





More information about the Python-list mailing list