python + bash + new user

Blake Winton bwinton at tor.dhs.org
Thu Jul 22 23:41:58 EDT 1999


On Fri, 23 Jul 1999 01:37:31 GMT, Jeff Bauer <jbauer at rubic.com> wrote:
>Joyce Stack wrote:
>> I did exactly as you said and chmod's etc but it just
>> says that it doesnt recognise "./simple.py" as a command.???
>> >         $ cat simple.py
>> >         #!/usr/bin/python
>Your python interpreter is not located in /usr/bin.  It may
>be in /usr/local/bin.  On many systems you can use the 'which'
>command to determine where the executable is.
>Alternatively, you can use the following line which works on
>many Unix systems:
>  #!/usr/bin/env python
>symlink-it-there-when-your-sysadmin's-not-looking-ly yr's,

So while we're on this topic, I seem to have hit a small snag...  I'm
using RedHat 6.something at home, and it ships with Python 1.5.1.  I've
also got an NT box at work where I'm using Python 1.5.2.  In the
interests of being able to move scripts from one box to the other, I've
installed Python 1.5.2 in /opt/{bin,lib/python1.5,man/man1}.  If I log
in myself, I can run /opt/bin/python, and get 1.5.2.  I can also create
a program with "#!/opt/bin/python", and if I type in "python spam.py" at
the command prompt, it works just fine.  Unfortunately, if I type in
"./spam.py", it doesn't do quite what I want it to.  I've traced my
problems down to sys.path (when it works, it points at /opt, when it
doesn't, it points at /usr), but I can't seem to figure out where it's
getting set, or how I can change it.  (I've tried setting $PYTHONHOME,
which works for me, but the whole reason I started this was to run cgi
scripts, and it's not working for the cgi scripts.)

So my question is this.  Can I get python working in such a way that if
it's being run from /opt, it will check /opt before /usr?  I'm not
averse to changing c files, and recompiling.

(Oh, yeah, the script is at http://tor.dhs.org/cgi-bin/daily.py  It just
grabs a bunch of comics, the weather in sunny Toronto, and the word of
the day, and puts them all up on one convienent page.  If any of the
people maintaining the script archives want a copy of it, I'ld be more
than happy to comment it, and send it off.)

Thanks,
Blake.

-- 
One Will.  One Dream.  One Truth.  One Destiny.  One Love.




More information about the Python-list mailing list