Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #110810

How to extract error information after failing to call Py_initialize()

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Tu Marshal <tucaiyong@hotmail.com>
Newsgroups comp.lang.python
Subject How to extract error information after failing to call Py_initialize()
Date Thu, 30 Jun 2016 04:34:31 +0000
Lines 23
Message-ID <mailman.122.1467262340.2358.python-list@python.org> (permalink)
References <PS1PR01MB06664E079AEE3C7DC2AD744EBA240@PS1PR01MB0666.apcprd01.prod.exchangelabs.com> <PS1PR01MB0666ED884C3D02F396210601BA240@PS1PR01MB0666.apcprd01.prod.exchangelabs.com>
Mime-Version 1.0
Content-Type text/plain; charset="gb2312"
Content-Transfer-Encoding base64
X-Trace news.uni-berlin.de 2VGe3+vQGZkllul/NVtdTQ3OYOzLAnROfKzdBceG18bw==
Return-Path <tucaiyong@hotmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'api.': 0.04; 'failing': 0.05; 'initialize': 0.05; 'main()': 0.07; 'method,': 0.07; 'redirected': 0.07; 'subject:How': 0.09; 'stderr': 0.09; 'subject:()': 0.09; 'python': 0.10; 'subject:error': 0.11; 'skip:f 30': 0.15; 'subject: \n ': 0.15; '"python': 0.16; '"w",': 0.16; 'crashed': 0.16; 'email addr:hotmail.com&gt;': 0.16; 'received:exchangelabs.com': 0.16; 'received:io': 0.16; 'received:prod.exchangelabs.com': 0.16; 'received:psf.io': 0.16; 'reproduce': 0.16; 'subject:after': 0.16; 'windows': 0.20; 'issue.': 0.20; 'suggested': 0.20; 'to:name:python- list@python.org': 0.20; 'thanks,': 0.24; 'header:In-Reply-To:1': 0.24; 'error': 0.27; 'back.': 0.27; 'crash': 0.29; 'preliminary': 0.29; 'work.': 0.30; 'reported': 0.32; 'skip:_ 30': 0.33; 'extract': 0.33; 'int': 0.33; 'requirement.': 0.33; 'stream': 0.33; 'file': 0.34; 'list': 0.34; 'but': 0.36; 'email addr:python.org': 0.36; 'to:addr:python-list': 0.36; 'received:10': 0.37; 'skip:& 10': 0.37; 'list.': 0.37; 'seem': 0.37; 'application': 0.39; "didn't": 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'skip:u 10': 0.61; 'more': 0.63; 'information': 0.63; 'our': 0.64; 'email name:help': 0.66; 'url:index': 0.67; 'customers': 0.70; 'url:2011': 0.75; '8bit%:46': 0.76; 'charset:gb2312': 0.79; 'experiment': 0.84; 'received:10.152': 0.84; 'url:posts': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=l+VJsUW7lXW/I0jYJ/kOKaEBXcsGcjXjnJst8Gt7K+E=; b=c7rdGxq/gZtkBfwuyORgdUnWQL0MifkjI9WyjV/nglkxHnKViEt66C9g7cnyCGn3MDYrjKauckWYqgXz/Aq0IXA57/i2fxEfpHmPWoL8z2DdBgrkLbb4UQSuVURjzsSfClyL7ReuDxk2B13cUooYv91VAmdY9jJUTbC6AoFFioH72opVbA2Jlkmjc5hcDMSEVUaTqnkvdud3qOosuaTnFvf05+zgSmRmVVNpNcmjhNmsWloNDhZ2BqEFAhXyqc3nG1Nlg2ZW6pxAVSWVVj8E6dRwb/2M3m5VDZuJiq4i5BXmK12W+WaqyhZHx63HcWdVhwdZ0qiv+Bae5LyDY6WNSA==
Thread-Topic How to extract error information after failing to call Py_initialize()
Thread-Index AQHR0fAkvjQI8Yak/0mFWiXsTj02nKABQJBDgAAszb4=
In-Reply-To <PS1PR01MB06664E079AEE3C7DC2AD744EBA240@PS1PR01MB0666.apcprd01.prod.exchangelabs.com>
Accept-Language zh-CN, en-US
Content-Language zh-CN
X-MS-Has-Attach
X-MS-TNEF-Correlator
authentication-results spf=softfail (sender IP is 25.152.250.56) smtp.mailfrom=hotmail.com; python.org; dkim=none (message not signed) header.d=none;python.org; dmarc=fail action=none header.from=hotmail.com;
received-spf SoftFail (protection.outlook.com: domain of transitioning hotmail.com discourages use of 25.152.250.56 as permitted sender)
x-ms-exchange-messagesentrepresentingtype 1
x-tmn [DkyCt5ktkIXql7uD1J54HSV4TyeiLtpj]
x-eopattributedmessage 0
x-forefront-antispam-report EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2APC01HT221; H:PS1PR01MB0666.apcprd01.prod.exchangelabs.com; FPR:; SPF:None; CAT:NONE; LANG:en; CAT:NONE;
x-ms-office365-filtering-correlation-id dba55a84-cbb1-46bd-cb30-08d3a09fd458
x-microsoft-antispam UriScan:; BCL:0; PCL:0; RULEID:(1601124038)(5061506196)(5061507196)(1601125047); SRVR:SG2APC01HT221;
x-exchange-antispam-report-cfa-test BCL:0; PCL:0; RULEID:(432015012)(82015046); SRVR:SG2APC01HT221; BCL:0; PCL:0; RULEID:; SRVR:SG2APC01HT221;
x-forefront-prvs 0989A7979C
X-OriginatorOrg hotmail.com
X-MS-Exchange-CrossTenant-originalarrivaltime 30 Jun 2016 04:34:31.1474 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader Internet
X-MS-Exchange-CrossTenant-id 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped SG2APC01HT221
X-OriginalArrivalTime 30 Jun 2016 04:34:34.0377 (UTC) FILETIME=[B3C36F90:01D1D288]
X-Mailman-Approved-At Thu, 30 Jun 2016 00:52:19 -0400
X-Content-Filtered-By Mailman/MimeDel 2.1.22
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <PS1PR01MB0666ED884C3D02F396210601BA240@PS1PR01MB0666.apcprd01.prod.exchangelabs.com>
X-Mailman-Original-References <PS1PR01MB06666DE262F36FCC1AFB8535BA230@PS1PR01MB0666.apcprd01.prod.exchangelabs.com>, <PS1PR01MB06664E079AEE3C7DC2AD744EBA240@PS1PR01MB0666.apcprd01.prod.exchangelabs.com>
Xref csiph.com comp.lang.python:110810

Show key headers only | View raw


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 <tucaiyong@hotmail.com>
发送时间: 2016年6月29日 18:31
收件人: help@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

How to extract error information after failing to call Py_initialize() Tu Marshal <tucaiyong@hotmail.com> - 2016-06-30 04:34 +0000

csiph-web