I am EE trying to write a script to make checking files easier with Python. For some reason, our IT experts will not allow me to access our smtp server and will allow me to send mail through mailx. So, I thought about starting mailx from Python and sending it the same way as in my console. Alas, this gives an opportunity. See Linux Log below:
***/depot/Python-3.1.1/bin/python3.1
Python 3.1.1 (r311:74480, Dec 8 2009, 22:48:08)
[GCC 3.3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> process=subprocess.Popen('echo "This is a test\nHave a loook see\n" | mailx -s "Test Python" mymail@mycomopany.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/depot/Python-3.1.1/lib/python3.1/subprocess.py", line 646, in __init__
errread, errwrite)
File "/depot/Python-3.1.1/lib/python3.1/subprocess.py", line 1146, in _execute_child
raise child_exception***
I'm new to Python (now migrating with PERL). Any thoughts?
source
share