Patches item #1038911, was opened at 2004-10-02 05:40 Message generated for change (Comment added) made by edemaine You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1038911&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Macintosh Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Nathan Gray (n8gray) Assigned to: Jack Jansen (jackjansen) Summary: OS X: Can't use #!/usr/bin/pythonw Initial Comment: At the moment, on OS X /usr/bin/pythonw2.x is a simple sh script that exec's a python interpreter within a valid OS X application bundle. The problem is that this prevents python scripts from using pythonw in the #! line. Darwin won't allow a script to act as an interpreter in a #! line. This patch replaces the shell script with a simple C program that does the same thing -- it just calls execv on the python interpreter within the OS X app bundle. Since it is a compiled executable it is allowed to act as an interpreter in #! lines. Your patch guidelines said you preferred multiple patches to be concatenated in a single file. My patch consists of a Makefile change and a new file, dist/src/Mac/OSX/pythonw.c. I've included both in the text file attached to this report. It would probably be prudent for somebody to review the Makefile change, since it's always tricky to find the right way to put a new file in someone else's build process. Thank you, -Nathan ---------------------------------------------------------------------- Comment By: Erik Demaine (edemaine) Date: 2006-04-03 12:48 Message: Logged In: YES user_id=265183 Is there a good reason why this patch has not been implemented ? It seems really strange to me that #!/usr/bin/pythonw doesn't work (but #!/usr/bin/python and #!/usr/bin/env pythonw do) because pythonw is made a shell script. Perhaps the root problem is that a symlink doesn't work, which is because of some other flaw in the interpreter somewhere? ---------------------------------------------------------------------- Comment By: Nathan Gray (n8gray) Date: 2004-10-04 16:16 Message: Logged In: YES user_id=121553 The issue is that sometimes you *do* care where python is installed, and you want to be sure to get the system python and not, for example, the Fink python. At the moment, the only solution is to use a gangly #! line like: #! /System/Library/Frameworks/Python.framework/Resources/ Python.app/Contents/MacOS/Python and you'll only figure that out if you're clever enough to understand why #!/usr/bin/python works but #!/usr/bin/pythonw doesn't. Mainly, it's just needlessly confusing to have a python interpreter that works from the command line but doesn't work in a #! line. It's unfortunate that the distinction between python and pythonw is necessary, but as long as it is then it would be nice if at least pythonw was able to act as a drop-in replacement for python. It's pretty simple to make it work as expected, so why not do it, for the sake of consistency? ---------------------------------------------------------------------- Comment By: Nick Coghlan (ncoghlan) Date: 2004-10-04 10:34 Message: Logged In: YES user_id=1038590 As described in the python tutorial, the recommended solution to this is to use the following on the shebang line: #! /usr/bin/env pythonw this also has benefit of not caring where python is installed. ---------------------------------------------------------------------- Comment By: Nathan Gray (n8gray) Date: 2004-10-02 21:00 Message: Logged In: YES user_id=121553 Assigning to Jack Jansen as suggested by Bob Ippolito on pythonmac-sig. ---------------------------------------------------------------------- Comment By: Nathan Gray (n8gray) Date: 2004-10-02 05:43 Message: Logged In: YES user_id=121553 By the way, the patch is against CVS head. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1038911&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
