[Python-Dev] towards a stricter definition of sys.executable

Fredrik Lundh fredrik at pythonware.com
Fri Mar 17 09:20:33 CET 2006


Fred L. Drake, Jr. wrote:

> Fredrik Lundh wrote:
>  >     d) If Python was started from a standard Python interpreter,
>
> My understanding matches Guido's description, so I'm not sure any changes are
> needed.

the problem with that is that your understanding doesn't match the implementation
(which implements (a), as the GetProgramFullPath name indicates).

as we've seen, lots of people (mainly application builders on windows) relies on the
implemented behaviour, while some people (mostly toolmakers, from what I can tell)
use guido's original interpretation.

I don't think many people embed setup.py scripts, so alternative (e) would pro-
bably cause the least problems:

    e) sys.executable contains the full path to the program used to invoke
    this interpreter instance, or None if this could not be determined.

    A new variable, sys.python_executable, is set to the name of the python
    executable used to invoke this interpreter instance.  If this instance is
    embedded, this variable may be set to a corresponding interpreter, or to
    None if no such interpreter is available.

    If Python is started from a standard Python interpreter, both variables
    are set to the same value.

any application that uses sys.executable to start another application will still work,
as long as the application is started via a standard interpreter.  embedded apps on
windows will still work as today.

</F>





More information about the Python-Dev mailing list