subprocess module raises OSError instead of IOError
This commit is contained in:
parent
bd7cf7e855
commit
0a04dbdeeb
|
@ -50,11 +50,11 @@ def uniqueName(*args, **kwargs):
|
||||||
def __sendmail(mail_from, mail_to, msg):
|
def __sendmail(mail_from, mail_to, msg):
|
||||||
import capisuite.core
|
import capisuite.core
|
||||||
from subprocess import Popen,PIPE,STDOUT
|
from subprocess import Popen,PIPE,STDOUT
|
||||||
sendmail_p = Popen(['/usr/sbin/sendmail', '-t'], stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
|
||||||
try:
|
try:
|
||||||
|
sendmail_p = Popen(['/usr/sbin/sendmail', '-t'], stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||||
text = sendmail_p.communicate(msg.as_string())[0]
|
text = sendmail_p.communicate(msg.as_string())[0]
|
||||||
except IOError: #Errno 32: Broken Pipe
|
except OSError as (errno, errstr): #Errno 32: Broken Pipe
|
||||||
capisuite.core.error("Error while calling sendmail. Not installed?\n")
|
capisuite.core.error("Error while calling sendmail. Not installed? (%s)\n" % errstr)
|
||||||
return 0
|
return 0
|
||||||
if text:
|
if text:
|
||||||
capisuite.core.error("Error while calling sendmail")#, return code=%i" % ret)
|
capisuite.core.error("Error while calling sendmail")#, return code=%i" % ret)
|
||||||
|
|
Loading…
Reference in New Issue