From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1MY5i5-0002dy-JQ for garchives@archives.gentoo.org; Mon, 03 Aug 2009 22:08:49 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B4819E0407; Mon, 3 Aug 2009 22:08:47 +0000 (UTC) Received: from mail.informasoftware.com (mail.informasoftware.com [66.193.169.4]) by pigeon.gentoo.org (Postfix) with ESMTP id 8E286E0407 for ; Mon, 3 Aug 2009 22:08:47 +0000 (UTC) Received: from [192.168.100.74] ([192.168.100.74] RDNS failed) by mail.informasoftware.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 3 Aug 2009 18:08:46 -0400 Message-ID: <4A775FF0.503@kutulu.org> Date: Mon, 03 Aug 2009 18:08:48 -0400 From: Mike Edenfield User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Thunderbird/3.0b3 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] bash stopped running python scripts... References: <4A774F13.1060307@kutulu.org> <200908032303.19327.alan.mckinnon@gmail.com> <4A775500.8040803@kutulu.org> <200908032348.05377.alan.mckinnon@gmail.com> In-Reply-To: <200908032348.05377.alan.mckinnon@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Aug 2009 22:08:46.0164 (UTC) FILETIME=[F88CF140:01CA1486] X-Archives-Salt: e43ea608-2be6-4916-8c4a-58c33c7ce6bf X-Archives-Hash: a0d7314090457bae5bf71d07f01adec6 On 8/3/2009 5:48 PM, Alan McKinnon wrote: > On Monday 03 August 2009 23:22:08 Mike Edenfield wrote: >> On 8/3/2009 5:03 PM, Alan McKinnon wrote: >>> On Monday 03 August 2009 22:56:51 Mike Edenfield wrote: >>>> kutulu@apollo ~ $ cat test.py >>>> #!/usr/bin/python >>>> import sys >>>> print "Python Ok." >>>> kutulu@apollo ~ $ ./test.py >>>> X connection to localhost:11.0 broken (explicit kill or server >>>> shutdown). ./test.py: line 3: print: command not found >>>> kutulu@apollo ~ $ python ./test.py >>>> Python Ok. >>>> kutulu@apollo ~ $ >>> >>> Did you recently merge python-3 and were so foolish as to make it the >>> default? >> >> I did emerge python-3, but then unmerged it almost immediately, and it >> was never the default. Python was already broken when I merged python >> 3.1, which I did to see if it fixed anything, which of course it didn't. >> >>> What is /usr/bin/python? and what version is it (-V)? >> >> root@apollo ~ # /usr/bin/python -V >> Python 2.6.2 >> root@apollo ~ # cat /usr/bin/python >> #!/bin/bash >> # Gentoo Python wrapper script >> >> [[ "${EPYTHON}" =~ (/|^python$) ]]&& EPYTHON="python2.6" >> "${0%/*}/${EPYTHON:-python2.6}" "$@" >> >> Is that supposed to be that way? I vaguely recall from my Tcl days that >> tclsh used to cause problems with the #! lines when it was a shell >> script, and that you had to use some odd exec trick to get tcl shell >> scripts to run. Is that still true? > > I have the identical file, it works here. That's very odd, as everything I've read over the past hour indicates that it's not *supposed* to work if you put a shell script in that line, but that's clearly not always true. What's the #! line in your /usr/bin/emerge file? > Your original post has a "X connection to localhost:11.0 broken" error, > which is mighty unusual. The error is common enough, but has nothing to do > with python. I know where that particular error is coming from. The first non-comment line in /usr/bin/emerge is "import sys". Since bash is interpreting the script instead of python, when it gets to that line, it runs ImageMagick's "import" command. It just indicates that bash ignored the #! line and kept going. The bug Remy sent me to did have two working solutions: replacing the shell script with a symlink, or replacing "#!/usr/bin/python" with "#!/usr/bin/env python" in emerge/ebuild, both of which point the #! line at a real executable. I'm now curious why that shell script works for anyone. --Mike