Loading ...
Sorry, an error occurred while loading the content.

How to get '#! /usr/bin/env python' to interpret in Python instead of Bash

Expand Messages
  • Joel Gebhart
    Hi, I installed HPLIP, and discovered all of its Python scripts start with the shebang #! /usr/bin/env python But this does not work on an Unslung NSLU2,
    Message 1 of 3 , Sep 30, 2008
    • 0 Attachment
      Hi,

      I installed HPLIP, and discovered all of its Python scripts start with the shebang
      #! /usr/bin/env python

      But this does not work on an Unslung NSLU2, because there is no env subdirectory.  I'm guessing that is usually a subdirectory listing environment variables.  Python scripts starting this way try to run in Bash, and Bash doesn't know what to do with them.  For Python scripts to run, the shebang line must be
      #! /usr/bin/python
      Which is a symbolic link to /opt/bin/python, which is a symbolic link to /opt/bin/python2.5

      I would rather not change all these scripts because there are so many of them, and it makes them different than the installed package.  I have searched Google for how to fix it where the shebang line #! /usr/bin/env python will be interpreted by Python.  I now vaguely understand the pros and cons of how to specify interpreters in shebang lines.  The problem is the supposed advantage to using #! /usr/bin/env python doesn't work in Unslung.  I haven't found anywhere it tells you how to correct this so if it doesn't work, you can make it work in your install.

      Can anyone tell me how to get #! /usr/bin/env python to interpret by the Python interpreter in Unslung?

      Thanks.


    • Mike (mwester)
      Joel Gebhart wrote: ... You need the /usr/bin/env program: ipkg install coreutils Mike (mwester)
      Message 2 of 3 , Sep 30, 2008
      • 0 Attachment
        Joel Gebhart wrote:
        ...
        > Can anyone tell me how to get /#! /usr/bin/env python/ to interpret by
        > the Python interpreter in Unslung?

        You need the /usr/bin/env program:

        ipkg install coreutils


        Mike (mwester)
      • Joel Gebhart
        ... Thanks, that worked perfectly.
        Message 3 of 3 , Oct 1, 2008
        • 0 Attachment
          > You need the /usr/bin/env program:
          > ipkg install coreutils

          Thanks, that worked perfectly.
        Your message has been successfully submitted and would be delivered to recipients shortly.