On 10/2/06, Rick Graves <gravesricharde@yahoo.com>
wrote:> I am using rsync to download files from rpm
> repositories (because yum will not work directly with
> my !@#$% ADSL service). I am calling rsync from a
> python script. When the rsync server is down, I get
> error messages, but the message goes to mail, so I get
> a message
>
> you have new mail in /var/spool/mail/rick
>
> I would prefer the error message would not go to mail,
> rather I would like to capture the text of the message
> in python. However, the things I have tried so far do
> not work.
I suppose the python script is being run through cron and rsync
inherits the script's stderr, so cron converts rsync's error messages
to mail? How to capture the rsync process's stderr is a Python
question, not an rsync one. Invoking rsync with popen3 should trap
the error messages and give you a stream from which you can read them.
Matt