#!/usr/bin/env python vs. #!/usr/bin/python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Vanderburg II

    #46
    Re: #!/usr/bin/env python vs. #!/usr/bin/python

    This is sort of related, but I'm wondering what is different between
    "#!/usr/bin/env python" and "#!python". Wouldn't the second do the same
    thing, since an absolute path is not specified, find 'python' from the
    PATH environment, I don't really know.

    Brian Vanderburg II

    Comment

    • D'Arcy J.M. Cain

      #47
      Re: #!/usr/bin/env python vs. #!/usr/bin/python

      On Thu, 08 May 2008 07:31:17 -0400
      Brian Vanderburg II <BrianVanderbur g2@aim.comwrote :
      This is sort of related, but I'm wondering what is different between
      "#!/usr/bin/env python" and "#!python". Wouldn't the second do the same
      thing, since an absolute path is not specified, find 'python' from the
      PATH environment, I don't really know.
      Well, I know what happened when I tried it. What happened when you
      tried it?

      --
      D'Arcy J.M. Cain <darcy@druid.ne t | Democracy is three wolves
      http://www.druid.net/darcy/ | and a sheep voting on
      +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

      Comment

      • Brian Vanderburg II

        #48
        Re: #!/usr/bin/env python vs. #!/usr/bin/python

        D'Arcy J.M. Cain wrote:
        On Thu, 08 May 2008 07:31:17 -0400
        Brian Vanderburg II <BrianVanderbur g2@aim.comwrote :
        >
        >This is sort of related, but I'm wondering what is different between
        >"#!/usr/bin/env python" and "#!python". Wouldn't the second do the same
        >thing, since an absolute path is not specified, find 'python' from the
        >PATH environment, I don't really know.
        >>
        >
        Well, I know what happened when I tried it. What happened when you
        tried it?
        >
        >
        I haven't tried it but I've seen some files like written that in the
        past with just a name and no path for some other interpreter (perl or sh
        probably) and didn't know what the different was or if it was even
        valid. I at a windows system now so I can't try it yet.

        Brian Vanderburg II

        Comment

        • Tim Roberts

          #49
          Re: #!/usr/bin/env python vs. #!/usr/bin/python

          Brian Vanderburg II <BrianVanderbur g2@aim.comwrote :
          >D'Arcy J.M. Cain wrote:
          >Brian Vanderburg II <BrianVanderbur g2@aim.comwrote :
          >>
          >>This is sort of related, but I'm wondering what is different between
          >>"#!/usr/bin/env python" and "#!python". Wouldn't the second do the same
          >>thing, since an absolute path is not specified, find 'python' from the
          >>PATH environment, I don't really know.
          >>
          >Well, I know what happened when I tried it. What happened when you
          >tried it?
          >
          >I haven't tried it but I've seen some files like written that in the
          >past with just a name and no path for some other interpreter (perl or sh
          >probably) and didn't know what the different was or if it was even
          >valid.
          It's not valid. The shebang line (#!) must specify a full path. When you
          saw the lone word ("perl"), it was probably a /usr/bin/env line, just we
          have been discussing.
          >I at a windows system now so I can't try it yet.
          *IF* you are interested in playing with Linux, most of the distributions
          have bootable CDs that will bring up a full Linux environment without ever
          touching your hard disk.
          --
          Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          Working...