ошибка: [Errno 32] Сломанная труба в приложении фляги

У меня никогда не было этой ошибки раньше, и я даже не знаю, с чего начать. Это простое веб-приложение, работающее на flask. Кажется, что в приложении все работает нормально, но оно продолжает выдавать мне эту ошибку, хотя все еще работает.

Вот полная распечатка ошибки:

Exception happened during processing of request from ('127.0.0.1', 61271)
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 657, in __init__
    self.finish()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 716, in finish
    self.wfile.close()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 283, in close
    self.flush()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

Вот мой код:

app = Flask(__name__)
Bootstrap(app)
app.config['FLASKS3_BUCKET_NAME'] = 'spokane-discount-properties'
s3 = FlaskS3(app)


@app.route("/", methods=['GET', 'POST'])
def index():
    context = {
    'image': url_for('static', filename= 'property_home.jpeg'),
    'heading': 'We sell property - At a discount!',
    'landing_video': url_for('static', filename='intro.mp4')
    }
    form = forms.OptIn()
    if form.validate_on_submit():
        validate = requests.get(
            "https://api.mailgun.net/v3/address/private/validate",
            auth=auth,
            params={"address": form.email.data})
        if validate.json()['did_you_mean'] is not None:
            flash('Did you mean {}?'.format(validate.json()['did_you_mean']))
        elif validate.json()['is_valid'] == True and validate.json()['is_role_address'] == False and validate.json()['is_disposable_address'] == False:
            r = requests.post(
            "https://api.mailgun.net/v3/lists/[email protected]/members",
            auth=auth,
            data={'subscribed': True,
                  'address': form.email.data})
            if r.status_code == 200:
                requests.post('https://api.mailgun.net/v3/mg.spokanediscountproperties.com/messages',
                    auth=auth,
                    data={"from": '[email protected]',
                        "to": form.email.data,
                        "subject": "Welcome to Spokane Discount Properties",
                        "html": open('templates/indoc.html'),
                        "o:tag": 'indoctrinated'})
                flash('Thanks, we will notify you when we have more properties')
            else:
                flash('You are already subscribed, we will notify you when more properties are available')
        else:
            flash('Holy guacamole! Best check yo self, this is not a valid email.')
    return render_template('index.html', form=form, context=context)

person freefly0313    schedule 30.08.2017    source источник
comment
stackoverflow.com/ вопросы/37962925/   -  person Aleksandr Borisov    schedule 30.08.2017