У меня есть скрипт python supervisor(e)d, который отправляет почту. Все нормально, когда я ssh и скрипт запускается из оболочки. Вывод тот же, без ошибок, конечно, и значение равно 0
evalue = -1
try:
f = tempfile.TemporaryFile()
f.write(body.encode('utf-8'))
f.seek(0)
log.debug("'%s'" % "' '".join(call))
for s in call:
log.debug(type(s))
evalue = subprocess.check_call(call, stdin=f)
except Exception as e:
log.exception(e)
finally:
f and f.close()
f = None
log.debug("evalue %s" % evalue)
Я вижу вывод:
mailer_v1 : DEBUG 'mailx' '-s' 'test ñññ ' '-a' '/tmp/test_ñññ_0,00_E.pdf' '-r' 'test <[email protected]>' '[email protected]'
: DEBUG <type 'str'>
mailer_v1 : DEBUG <type 'str'>
mailer_v1 : DEBUG <type 'unicode'>
mailer_v1 : DEBUG <type 'str'>
mailer_v1 : DEBUG <type 'unicode'>
mailer_v1 : DEBUG <type 'str'>
mailer_v1 : DEBUG <type 'unicode'>
mailer_v1 : DEBUG <type 'unicode'>
mailer_v1 : ERROR execv() arg 2 must contain only strings
Traceback (most recent call last):
File "/data/workers/mailer_v1", line 90, in <module>
evalue = subprocess.check_call(call, stdin=f)
File "/usr/lib/python2.7/subprocess.py", line 506, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
TypeError: execv() arg 2 must contain only strings
mailer_v1 : DEBUG evalue -1
Локаль в оболочке es_ES.UTF-8 и в конфиге супервизора у меня есть
environment=LC_ALL=es_ES.UTF-8
Спасибо.