FAQ
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?

Search Discussions

  • Emile van Sebille at Jan 15, 2001 at 4:02 am
    How about trying the full python2 path in .qmail preceeding
    your script file name:

    ------------------------------------------------
    /big/dom/xthinkspot/thinker/python/Python-2.0/python
    /big/dom/xthinkspot/mailtofile.py |vdeliver
    ------------------------------------------------

    --

    Emile van Sebille
    emile at fenx.com
    -------------------


    "Sheila King" <sheila at thinkspot.net> wrote in message
    news:rkp46t8atkoabsmu7v159sm32c0mslp40p at 4ax.com...
    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/
  • Sheila King at Jan 15, 2001 at 4:24 am
    On Sun, 14 Jan 2001 20:02:00 -0800, "Emile van Sebille" <emile at fenx.com> wrote
    in comp.lang.python in article <93tsoe$bja9b$1 at ID-11957.news.dfncis.de>:

    :How about trying the full python2 path in .qmail preceeding
    :your script file name:
    :
    :------------------------------------------------
    :|/big/dom/xthinkspot/thinker/python/Python-2.0/python
    :/big/dom/xthinkspot/mailtofile.py |vdeliver
    :------------------------------------------------

    Thanks for the suggestion. I had tried it before, but I tried it again, at
    your suggestion.

    Still doesn't work. :-(
  • Erik Max Francis at Jan 15, 2001 at 4:34 am

    Sheila King wrote:

    Thanks for the suggestion. I had tried it before, but I tried it
    again, at
    your suggestion.

    Still doesn't work. :-(
    What you should generally do at this point is do some sanity checks.
    What version of Python is it actually running? Instead of the program
    you'd like to run, replace it with a simple little script that prints
    information about the Python version. Once you know where you are you
    can go on from there.

    --
    Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
    __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
    / \ Whoever named it necking was a poor judge of anatomy.
    \__/ Groucho Marx
    Official Omega page / http://www.alcyone.com/max/projects/omega/
    The official distribution page for the popular Roguelike, Omega.
  • Sheila King at Jan 15, 2001 at 5:33 am
    On Mon, 15 Jan 2001 03:12:04 GMT, Sheila King <sheila at thinkspot.net> wrote in
    comp.lang.python in article <rkp46t8atkoabsmu7v159sm32c0mslp40p at 4ax.com>:

    :My web host offers Python 1.5.1.
    ...<snipped>...
    :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.
    ...<snipped>...
    :I can't get some mail scripts that I had running before under 1.5.1 to run
    :under 2.0.

    I've been given a clue from the Sysadmin:
    I've installed Python in the wrong directory. The mail program doesn't have
    permission to access my $HOME directory, and I've installed Python2.0 in a
    subdirectory of HOME. So, I need to uninstall it, and then reinstall it into a
    directory that the mail program has access to.

    What is the recommended uninstall procedure? I'm tempted to simply delete the
    entire Python-2.0 folder, but don't want to get myself in trouble...
  • Sheila King at Jan 15, 2001 at 7:20 am
    On Mon, 15 Jan 2001 05:33:42 GMT, Sheila King <sheila at thinkspot.net> wrote in
    comp.lang.python in article <ro256tkkmuf2j6lq6279ofr871269j7fnj at 4ax.com>:

    :I've been given a clue from the Sysadmin:
    :I've installed Python in the wrong directory. The mail program doesn't have
    :permission to access my $HOME directory, and I've installed Python2.0 in a
    :subdirectory of HOME. So, I need to uninstall it, and then reinstall it into a
    :directory that the mail program has access to.

    Well, I have this problem solved, at least. Python 2.0 is installed, and my
    script is functioning. I did have to put the full path in the .qmail file, as
    suggested by Emile van Sebille. That, plus installing it in a directory where
    the permissions allowed the mail program to access it, solved the problem.
  • Keith F. Woeltje at Jan 15, 2001 at 12:29 pm
    Sheila--thanks for posting the follow-up. I may be facing a similar
    situation soon, and this could save me a lot of headaches. Too often we
    never hear what the final resolution of a problem was.
    K
    Sheila King wrote:
    Well, I have this problem solved, at least. Python 2.0 is installed, and my
    script is functioning. I did have to put the full path in the .qmail file, as
    suggested by Emile van Sebille. That, plus installing it in a directory where
    the permissions allowed the mail program to access it, solved the problem.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJan 15, '01 at 3:12a
activeJan 15, '01 at 12:29p
posts7
users4
websitepython.org

People

Translate

site design / logo © 2022 Grokbase