[New-bugs-announce] [issue13533] Would like Py_Initialize to play friendly with host app

dangermouseb report at bugs.python.org
Mon Dec 5 16:36:34 CET 2011

New submission from dangermouseb <david at bigredmedia.tv>:

I'm building a dll add-in (on Windows) in which I want to use the installed version of Python, not provide my own installation. When py_initialize fails it appears to call exit(). This doesn't seem very friendly behaviour for an embeddable scripting language as the host application is terminated (out of my control).

So my request is that either py_initialize is changed to return a code indicating failure or sucess or another function is added to th api to test if the installation is good or not. That way I can report to the user that there is a problem in the python installation rather than apparently crashing the host app.

Currently the only strategy I've thought of to get around this is to fork a seperate process, and inspect it after a delay to see if it is running (indicating that py_initialize hasn't failed), terminate the new process and then call py_initialize in the host application process.

This has been raised before but only in terms of consistency with the documentation, not about if a embeddable scripting engine should terminate the hosting process without regard to that host.

Many thanks,


components: None
messages: 148875
nosy: dangermouseb
priority: normal
severity: normal
status: open
title: Would like Py_Initialize to play friendly with host app
type: feature request
versions: Python 2.7, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list