This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: #!/usr/bin/python can find wrong python
Type: Stage:
Components: macOS Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jackjansen Nosy List: jackjansen, loewis, nirs
Priority: high Keywords:

Created on 2004-04-10 21:34 by jackjansen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg20473 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2004-04-10 21:34
It seems that in the event of a script run with #!/usr/bin/python 
MacOSX will not pass a full pathname as argv[0], but only 
"python".

When getpath.c notices this situation it looks over $PATH to try and 
find python. But if it doesn't find the python from #!, or finds 
another one first, it will use that python as the basis for its 
sys.path setting.

The darwinports folks have a fix for this: <http://
www.opendarwin.org/pipermail/cvs-darwinports-all/2004-February/
023306.html>. 
msg20474 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-04-15 20:54
Logged In: YES 
user_id=21627

Isn't that a Darwin bug?
msg20475 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2004-04-15 22:10
Logged In: YES 
user_id=45365

I think I agree that it is technically a darwin bug. But as a fix is available 
(use another means to get the pathname of the current executable if 
argv[0] seems bogus) I think we should put it in.
msg20476 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2004-06-03 14:39
Logged In: YES 
user_id=45365

Fixed in 1.47 and 1.46.14.1 by applying the darwinports fix.

Thanks!
msg20477 - (view) Author: Nir Soffer (nirs) * Date: 2004-09-09 22:59
Logged In: YES 
user_id=832344

The bug is stil present in Python 2.3.4, but there is a workaround, see http:/
/www.pythonmac.org/wiki/DuelingPythonsOnPanther
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40139
2004-04-10 21:34:59jackjansencreate