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:
> >> kut...@apollo ~ $ cat test.py
> >> #!/usr/bin/python
> >> import sys
> >> print "Python Ok."
> >> kut...@apollo ~ $ ./test.py
> >> X connection to localhost:11.0 broken (explicit kill or server
> >> shutdown). ./test.py: line 3: print: command not found
> >> kut...@apollo ~ $ python ./test.py
> >> Python Ok.
> >> kut...@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)?
>
> r...@apollo ~ # /usr/bin/python -V
> Python 2.6.2
> r...@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. 

> Looking back through my emerge.log it appears that the last thing to
> successfully run through emerge was eselect-python, if that makes a
> difference.

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.

Try some brief out-of-the-box tests:

1. Does test.py run OK from a virtual console?
2. Have you logged out and back in to X since merging python?
3. Have you re-merged python-2.6 just in case your sys lib is damaged?

-- 
alan dot mckinnon at gmail dot com

Reply via email to