Making a shorter shebang

Discussion in 'Python' started by veracon, Oct 14, 2006.

  1. veracon

    veracon Guest

    Long story short, in order to use Python 2.5, I've compiled it in my
    own account on my hosting. It works fantastic as
    /home/my_username/python2.5, but the shebang is a bit long. Is there a
    way to shorten it (environment variables?) or, even better, make
    /usr/bin/env python point to it?

    Thanks in advance!
     
    veracon, Oct 14, 2006
    #1
    1. Advertising

  2. veracon

    Jerry Guest

    /usr/bin/env just searches your PATH variable to find it, but it does
    so in order. So, if you want it to find your python instead of a
    system provided one, just alter your PATH variable and put
    /home/my_username/python2.5 in front of everything else.

    example in .profile:

    PATH=/home/<username>/python2.5:$PATH
    export PATH

    --
    Jerry

    On Oct 14, 10:37 am, "veracon" <> wrote:
    > Long story short, in order to use Python 2.5, I've compiled it in my
    > own account on my hosting. It works fantastic as
    > /home/my_username/python2.5, but the shebang is a bit long. Is there a
    > way to shorten it (environment variables?) or, even better, make
    > /usr/bin/env python point to it?
    >
    > Thanks in advance!
     
    Jerry, Oct 14, 2006
    #2
    1. Advertising

  3. veracon

    veracon Guest

    Thanks a lot!

    Jerry wrote:
    > /usr/bin/env just searches your PATH variable to find it, but it does
    > so in order. So, if you want it to find your python instead of a
    > system provided one, just alter your PATH variable and put
    > /home/my_username/python2.5 in front of everything else.
    >
    > example in .profile:
    >
    > PATH=/home/<username>/python2.5:$PATH
    > export PATH
    >
    > --
    > Jerry
    >
    > On Oct 14, 10:37 am, "veracon" <> wrote:
    > > Long story short, in order to use Python 2.5, I've compiled it in my
    > > own account on my hosting. It works fantastic as
    > > /home/my_username/python2.5, but the shebang is a bit long. Is there a
    > > way to shorten it (environment variables?) or, even better, make
    > > /usr/bin/env python point to it?
    > >
    > > Thanks in advance!
     
    veracon, Oct 14, 2006
    #3
  4. veracon

    veracon Guest

    Actually, it appears to still be using the default binary
    (/usr/bin/python). Can I be sure it's actually reading the .profile
    file? I'm executing through regular CGI in Apache.

    veracon wrote:
    > Thanks a lot!
    >
    > Jerry wrote:
    > > /usr/bin/env just searches your PATH variable to find it, but it does
    > > so in order. So, if you want it to find your python instead of a
    > > system provided one, just alter your PATH variable and put
    > > /home/my_username/python2.5 in front of everything else.
    > >
    > > example in .profile:
    > >
    > > PATH=/home/<username>/python2.5:$PATH
    > > export PATH
    > >
    > > --
    > > Jerry
    > >
    > > On Oct 14, 10:37 am, "veracon" <> wrote:
    > > > Long story short, in order to use Python 2.5, I've compiled it in my
    > > > own account on my hosting. It works fantastic as
    > > > /home/my_username/python2.5, but the shebang is a bit long. Is there a
    > > > way to shorten it (environment variables?) or, even better, make
    > > > /usr/bin/env python point to it?
    > > >
    > > > Thanks in advance!
     
    veracon, Oct 14, 2006
    #4
  5. In <>, veracon wrote:

    > Actually, it appears to still be using the default binary
    > (/usr/bin/python). Can I be sure it's actually reading the .profile
    > file? I'm executing through regular CGI in Apache.


    The `~/.profile` is executed when *you* log into your account. CGI
    scripts are executed by the web server which usually has its own user and
    group, `wwwrun` or something like that, and does not read the `.profile`
    in your home directory.

    Ciao,
    Marc 'BlackJack' Rintsch
     
    Marc 'BlackJack' Rintsch, Oct 14, 2006
    #5
  6. veracon

    veracon Guest

    Thanks, at least now I know I wasn't doing something wrong.

    Marc 'BlackJack' Rintsch wrote:
    > In <>, veracon wrote:
    >
    > > Actually, it appears to still be using the default binary
    > > (/usr/bin/python). Can I be sure it's actually reading the .profile
    > > file? I'm executing through regular CGI in Apache.

    >
    > The `~/.profile` is executed when *you* log into your account. CGI
    > scripts are executed by the web server which usually has its own user and
    > group, `wwwrun` or something like that, and does not read the `.profile`
    > in your home directory.
    >
    > Ciao,
    > Marc 'BlackJack' Rintsch
     
    veracon, Oct 14, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan Bishop

    Re: shebang strange thing...

    Dan Bishop, Jun 24, 2003, in forum: Python
    Replies:
    19
    Views:
    1,141
    Ben Finney
    Jun 29, 2003
  2. Andres Corrada-Emmanuel

    Optimize flag on shebang line

    Andres Corrada-Emmanuel, Dec 9, 2003, in forum: Python
    Replies:
    0
    Views:
    328
    Andres Corrada-Emmanuel
    Dec 9, 2003
  3. rbt
    Replies:
    5
    Views:
    17,489
    Bill Mill
    Apr 6, 2005
  4. Joerg Schuster

    compile shebang into pyc file

    Joerg Schuster, Apr 26, 2005, in forum: Python
    Replies:
    11
    Views:
    706
    Joerg Schuster
    Apr 28, 2005
  5. Chris Lasher

    Shebang or Hashbang for modules or not?

    Chris Lasher, Apr 11, 2007, in forum: Python
    Replies:
    13
    Views:
    2,460
    Steven W. Orr
    Apr 23, 2007
Loading...

Share This Page