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

Trent Mick trentm at ActiveState.com
Thu Mar 16 19:00:28 CET 2006

> Fredrik Lundh wrote:
> >     a) sys.executable points to the executable that was used to load the
> >     Python interpreter library/dll.
> > 
> >     this use is supported by the docstring and the implementation, and is quite
> >     common in the wild.  an application using this interpretation may
> > 
> >     - call sys.executable to run another instance of itself
> >     - extract data from resources embedded in (or attached to) sys.executable
> >     - locate configuration data etc via os.path.dirname(sys.executable)
> > 
> >     etc.

[Thomas Heller wrote]
> py2exe used the a) interpretation.  It uses sys.executable to find the exe that is currently
> running, for registration of COM servers, and for finding resources in the exe: the manifest
> file that's needed for GUI applications on WindowsXP to give the native XP look and feel,
> icons, typelibs, and more.
> The use case for b) 'call sys.executable to run a Python script' makes no sense for
> a py2exe'd application.

Ditto on both counts for PyXPCOM (Python embedded in Mozilla).


Trent Mick
TrentM at ActiveState.com

More information about the Python-Dev mailing list