smptlib frustration!

J

Joe

Ok I have written a perfectly well working script that uses smptlib
module to email myself if the script ended in success or failure.
However, this module automatically outputs the results to the console
to show the status of the connection/send/recieve etc... This is a
big problem for me. I am trying to run this script from Backup Exec
as a pre-processing job. This causes my script to always fail because
Backup Exec pre-processing jobs can not output to a console! What am
I to do? Is there a way to stop this module from outputing the status
to the console without having to actually modify the standard module?
Thanks!
 
P

Peter Hansen

Joe said:
Ok I have written a perfectly well working script that uses smptlib
module to email myself if the script ended in success or failure.
However, this module automatically outputs the results to the console
to show the status of the connection/send/recieve etc... This is a
big problem for me. I am trying to run this script from Backup Exec
as a pre-processing job. This causes my script to always fail because
Backup Exec pre-processing jobs can not output to a console! What am
I to do? Is there a way to stop this module from outputing the status
to the console without having to actually modify the standard module?

If you must do this from within the program rather than being
able to do the simplest thing, which is to use redirection to
dump the output to nowhere... (/dev/null or >nil depending on
your OS, if it's Linux or Win32)... then you can use something
like this:

import sys
class Sink:
def write_null(self, *pargs):
pass
sys.stdout = sys.stderr = Sink()

There may be a simplification possible, but it's been a while since
I've had to do that...

-Peter
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,635
Latest member
SkyePurves

Latest Threads

Top