Shebang line problems and python

Chris Rebert clp2 at rebertia.com
Thu Sep 17 05:35:43 CEST 2009


On Wed, Sep 16, 2009 at 8:25 PM, Blaine <brlafreniere 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.

Admittedly stupid questions:
1. Is there actually anything located at /usr/bin/python ?
2. What does "which python" output in bash?

Cheers,
Chris



More information about the Python-list mailing list