Message info
To:Ronald Oussoren From:Martin v. Löwis Subject:Re: [Python-Dev] PEP 405 (pyvenv) and system Python upgrades Date:Mon, 07 May 2012 22:51:21 +0200

> The bin/python3 executable in a framework is a small stub that
> execv's the real interpreter that is stuffed in a bundle
> inside the Python framework. That's done to ensure that GUI code can
> work from the command-line, Apple's GUI framework refuse to work when
> the executable is not in an application bundle.
> Because of this trick pyvenv won't know which executable the user
> actually called and hence cannot find the pyvenv configuration file
> (which is next to the stub executable).

I don't understand. The "executable that the user actually called":
does that refer to

a) the stub (which the user *actually* called) or
b) the eventual binary (which is what gets *actually* run).

If a), then I think argv[0] just needs to continue to refer to the
stub, which is easy to achieve in execv.

If b), I wonder why the code needs to know the location to the binary
inside the bundle. But if this is needed to know, I suggest that some
environment variable is passed from the stub to the actual binary
(akin PYTHONHOME). How does the stub normally find out where the
framework is located?

Python-Dev mailing list