Hello Experts,
I sent my issue to Python help email list. Matt from that list suggested me to ask help from "Python list". The link described how to get error information from Python after Python is initialized. It didn't meet my requirement. http://mateusz.loskot.net/posts/2011/12/01/python-sys-stdout-redirection-in-cpp/index.html Thanks, Marshal ________________________________ 发件人: Tu Marshal <tucaiy...@hotmail.com> 发送时间: 2016年6月29日 18:31 收件人: h...@python.org 主题: How to extract error information after failing to call Py_initialize() Hello Experts, Our windows application is using Python C API. But some customers reported our application crashed during Python initialization. Unfortunately we cannot reproduce the issue. We are thinking if we dump more error information to the crash report so that we can narrow the issue down. I did some experiment to redirect stderr streame to file so that I can get the error information back. But the piece of codes don't seem to work. In Python initialize method, the stderr would be redirected to "a preliminary stderr printer" from comments. Any ideas? int main() { FILE* stream = freopen("stderr.txt", "w", stderr); Py_Initialize(); fclose(stream); } Thanks, Marshal -- https://mail.python.org/mailman/listinfo/python-list