python - IO Error - Flask-mail and running server with proxy -
i'm very wierd bug...
i have flask app using flask-mail send email messages.
in redhat server, tryied using runserver (flask-manager) , gunicorn. have apache server connecting app using proxy.
when run app, using user (root or other), app runs , sends emails normally.
but when close session server (exit in terminal) stops send mail , gives me stack trace:
in send_mail return mail.send(msg) file "/usr/local/lib/python2.7/site-packages/flask_mail.py", line 415, in send self.connect() connection: file "/usr/local/lib/python2.7/site-packages/flask_mail.py", line 123, in __enter__ self.host = self.configure_host() file "/usr/local/lib/python2.7/site-packages/flask_mail.py", line 144, in configure_host host.login(self.mail.username, self.mail.password) file "/usr/local/lib/python2.7/smtplib.py", line 575, in login self.ehlo_or_helo_if_needed() file "/usr/local/lib/python2.7/smtplib.py", line 535, in ehlo_or_helo_if_needed if not (200 <= self.ehlo()[0] <= 299): file "/usr/local/lib/python2.7/smtplib.py", line 406, in ehlo self.putcmd(self.ehlo_msg, name or self.local_hostname) file "/usr/local/lib/python2.7/smtplib.py", line 336, in putcmd self.send(str) file "/usr/local/lib/python2.7/smtplib.py", line 320, in send print>>stderr, 'send:', repr(str) ioerror: [errno 5] input/output error
running manager:
- python myapp.py
running gunicorn use:
- gunicorn -w 2 -b 0.0.0.0:8388 myapp:app
i'm stuck here.. tested using 2 different containers... not have other ideias solve it... using wsgi not make work on server cause lib not install @ =(
any other ideas?
thanks!
looking @ smtplib source (https://hg.python.org/cpython/file/2.7/lib/smtplib.py#l324), looks what's happening you're trying write stderr, may source of i/o error when running under server.
if you're setting smtp(...).debuglevel
anywhere, try removing line.
Comments
Post a Comment