我在 shell 中使用 mail 命令发送电子邮件:
echo "abc" | mail -s "Subject" abc@def.com
我想在python中使用这个命令,所以我写了以下内容:
call("echo abc" "|" "mail", "-s Subject", "abc@def.com", shell=True)
然后它给了我以下错误:
Original exception was:
Traceback (most recent call last):
File "email.py", line 7, in <module>
call("mail", "-s", "Subject", "abc@def.com", shell=True)
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 629, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer
这是什么原因?