[issue15020] Poor default value for progname

Joshua Cogliati report at bugs.python.org
Thu Jun 7 00:37:29 CEST 2012


New submission from Joshua Cogliati <jrincayc at gmail.com>:

In Python/pythonrun.c the following definition exists:
static wchar_t *progname = L"python";

This is then used by Py_GetProgramName which is used by calculate_path in Modules/getpath.c 

Since in python 3, the default executable is python3, and not python, when calculate_path searches for "python" it will find where python 2 is installed instead of where python3 is installed.  This is the error message that this causes:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]

I recommend that line be changed to:
static wchar_t *progname = L"python3";

since that is the default executable name.

For my purposes (which is making an executable that embedds python 3), I was able to work around this by calling: 
Py_SetProgramName(L"python3");
before
Py_Initialize();

----------
messages: 162425
nosy: Joshua.Cogliati
priority: normal
severity: normal
status: open
title: Poor default value for progname
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15020>
_______________________________________


More information about the Python-bugs-list mailing list