Help with Python install

Sheila King sheila at thinkspot.net
Sun Jan 14 22:12:04 EST 2001


My web host offers Python 1.5.1. It is not possible for the host to upgrade at
this time, because it would require an entire rebuild of the server core (the
servers are highly customized).

But I really wanted to use a more recent version. I was given permission to
install 2.0 in my own directory space. I have done so, and it appears to be
working.

The host is running RedHat Linux with Apache as the server. Python 1.5.1 is in
the path, and anyplace I type >python, in any directory, the interpreter comes
up.

Even in the directory where I installed 2.0. To get the 2.0 interpreter to
come up, I have to type the full path. The 2.0 install seems to be running
fine. I used the smtplib and sent myself an e-mail. I added a few numbers.
Printed some messages to the screen. Looks fine.

However...

I can't get some mail scripts that I had running before under 1.5.1 to run
under 2.0.

Using .qmail files I'm invoking these scripts when mail arrives for my
account. The contents of my .qmail file are shown below:
------------------------------------------------
|/big/dom/xthinkspot/mailtofile.py |vdeliver
------------------------------------------------

So, when a mail arrives, it calls the script mailtofile.py and runs that, with
the newly arrived mail being read on stdin.

This is the first version of mailtofile.py:
------------------------------------------------
#! /usr/bin/python

import sys, os

rawmessage = sys.stdin.read()
outfile = open("./outmessage.txt", "w")
sys.stdout=outfile
print rawmessage
outfile.close()
os.chmod("./outmessage.txt", 0664)
------------------------------------------------

When I send an e-mail, it gets copied to the textfile outmessage.txt. No
problem. However, it is running the Python 1.5.1 from my host.

So, I tried changing it to this:

-----------------------------------------------
#! /big/dom/xthinkspot/thinker/python/Python-2.0/python

import sys, os

rawmessage = sys.stdin.read()
outfile = open("./outmessage.txt", "w")
sys.stdout=outfile
print rawmessage
outfile.close()
os.chmod("./outmessage.txt", 0664)
----------------------------------------------

The only thing that has been changed is the path. I have not changed the file
name, or anything else. But this doesn't appear to run at all. Well, the
.qmail file tries to do something. I do get a blank e-mail as a result. But
the python script doesn't appear to do it's thing.

I'm wondering what I need to do? I suppose I need to set my .bash_profile so
that my Python 2.0 is added to my path? or my environment? or something?

Could someone help me out here?



--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/



More information about the Python-list mailing list