On Fri, 4 May 2012 08:44:25 +0000 (UTC) Vinay Sajip <vinay_sa...@yahoo.co.uk> wrote: > IIUC, the program name of the Python executable is set to whatever argv[0] is. > Is there a reason for this, rather than using one of the various OS-specific > APIs [1] for getting the name of the running executable? The reason I ask is > that in a virtual environment (venv), the exe's path is the only thing you > have > to go on, and if you don't have that, you can't find the pyvenv.cfg file and > hence the base Python from which the venv was created. > > Of course argv[0] is normally set to the executable's path, but there's at > least > one test (in test_sys) where Python is spawned (via subprocess) with argv[0] > set > to "nonexistent". If run from a venv created from a source build, with no > Python > 3.3 installed, this test fails because the spawned Python can't locate the > locale encoding, and bails.
If that's the only failing test, we can simply skip it when run from a venv. A non-existent argv[0] is arguably a borderline case which you should only encounter when e.g. embedding Python. > I would prefer to use option 2 and change getpath.c / getpathp.c accordingly. > Does anyone here see problems with that approach? getpath.c is sufficiently byzantine that we don't want to complexify it too much, IMHO. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com