smptlib frustration!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe

    smptlib frustration!

    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!
  • Peter Hansen

    #2
    Re: smptlib frustration!

    Joe wrote:
    [color=blue]
    > 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?[/color]

    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

    Comment

    Working...