Shebang line problems and python

Rami Chowdhury rami.chowdhury at gmail.com
Thu Sep 17 03:24:09 EDT 2009


> I think I've discovered the problem. Someone from IRC had directed me
> here: http://bugs.gentoo.org/show_bug.cgi?id=279915

I would suggest testing with the Python binary itself in your shebang line 
(e.g. #!/usr/bin/python2.6, if it's in /usr/bin) to confirm, but that looks 
like it :-)

----
Rami Chowdhury
"Any sufficiently advanced incompetence is indistinguishable from malice." -- 
Grey's Law
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)

On Wednesday 16 September 2009 23:27:12 Blaine wrote:
> On Sep 16, 9:25 pm, Blaine <brlafreni... at gmail.com> wrote:
> > Hello,
> >
> > Scripts that have "#!/usr/bin/python" at the top do not parse
> > correctly. Bash treats scripts with that shebang as if they are bash
> > scripts.
> >
> > E.g.:
> > blaine at attila ~/apps/rs-mu $ /usr/sbin/env-update
> > /usr/sbin/env-update: line 6: import: command not found
> > /usr/sbin/env-update: line 8: syntax error near unexpected token `('
> > /usr/sbin/env-update: line 8: `def usage(status):'
> >
> > Scripts with "#!/usr/bin/env python" at the top work fine. In fact,
> > `python` and `env python` both bring me to a python interpreter.
> >
> > I've tried other types of scripts. #!/bin/bash works, #!/usr/bin/perl
> > works, #!/usr/bin/ruby works, etc. (and so do their #!/usr/bin/env
> > <interpreter> counterparts.) Because of this, I'm not sure if it is a
> > Python issue or a system issue.
> >
> > Any and all advice appreciated, thanks.
> >
> > P.S. some system info:
> > blaine at attila ~/apps/rs-mu $ uname -a
> > Linux attila 2.6.27-gentoo #5 SMP Sun Oct 19 19:13:17 MST 2008 i686
> > AMD Athlon(tm) 64 X2 Dual Core Processor 4000+ AuthenticAMD GNU/Linux
> >
> > blaine at attila ~/apps/rs-mu $ python --version
> > Python 2.6.2
> >
> > blaine at attila ~/apps/rs-mu $ bash --version
> > GNU bash, version 4.0.28(2)-release (i686-pc-linux-gnu)
> > Copyright (C) 2009 Free Software Foundation, Inc.
> > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/
> > gpl.html>
>
> I think I've discovered the problem. Someone from IRC had directed me
> here: http://bugs.gentoo.org/show_bug.cgi?id=279915



More information about the Python-list mailing list