sending commands to the unix shell

Rodrick Brown rodrick.brown at gmail.com
Mon Oct 11 22:30:53 EDT 2010


Trying to do something very trivial why is it failing

I've tried three approaches
    1. os.system("/bin/cat %s | /bin/mail -s \'connection error\' %s" %
(logFile,notifyList))
    2. os.system("/bin/mail -s \'connection error\' %s < %s" %
(notifyList,logFile))
    3. p1 = sp.Popen(["/bin/cat", logFile], stdout=sp.PIPE)
        p2 = sp.Popen(["/bin/mail", "-s", "error", notifyList],
stdin=p1.stdout, stdout=sp.PIPE)

Please help and explain why all 3 methods fail.

-- 
[ Rodrick R. Brown ]
http://www.rodrickbrown.com http://www.linkedin.com/in/rodrickbrown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101011/9529c4db/attachment.html>


More information about the Python-list mailing list