On Thu, Jan 26, 2017 at 3:58 PM Dave Page <dpage@pgadmin.org> wrote:
In the meantime, I'm thinking something like the attached patch would be more appropriate. The only issue I can find with it at the moment (having just tested on a Mac dev environment for now) is that if initialisation fails and you enter a new Python Executable path, the Py_Finalize()/Py_Initialize cycle isn't enough to make the change - it seems to be because Py_SetProgramName() doesn't have any effect when called again. In other words, you can give it the correct interpreter and hit OK to attempt to run the server again, but it still won't work until you actually restart the app.
Any ideas?
Looking through the cpython code, Py_SetPath(NULL) clears the calculated module search path again. Try calling this before the Py_Initialize.