SyntaxError: invalid syntax but followed the WTF documentation and still doesn't accept it

SyntaxError: invalid syntax but followed the WTF documentation and still doesn't accept it

学习python烧瓶和WTF。一直在根据文档和教程处理下面的代码,但似乎无法找到错误。

Controller.py

from flask import Flask, escape, request, render_template, url_for, flash, redirect, send_from_directory, json, jsonify

from flask_wtf import FlaskForm
from wtforms import (StringField, PasswordField, SubmitField, BooleanField, DateTimeField, 
                        RadioField, SelectField, TextField, TextAreaField, SubmitField)

from wtforms.validators import DataRequired, Length, Email, EqualTo
from form import infoForm


app = Flask(__name__)
app.config['SECRET_KEY'] = 'asdfghjklqwertyuiop1234567890'

@app.route('/test', methods=['GET','POST'])
def test():
    breed = False 
    form = infoForm()
    if form.validate_on_submit():
        session['breed'] = form.breed.data
        session['neutered'] = form.neutered.data 
        session['mood'] = form.mood.data 
        session['food_option'] = form.food_option.data 
#       breed = form.breed.data
#       form.breed.data = ''
#   return render_template('test.html', form = form, breed = breed)
        return redirect(url_for('/'))
    return render_template('test.html', form = form) 

forms.py

class infoForm(FlaskForm):

    # Used by forms.py essentially  
    breed = StringField("What breed are you?", validators = [DataRequired()])
    neutered = BooleanField("Have you been neutered?"), choices = ['Yes'])
    mood = RadioField('Please choose your mood: '),choices = [('mood_one','Happy'), ('mood_2','Sad')]
    food_option = SelectField(u'Pick your fav food: '), choices = [('chic','Chicken') , ('bf','beef') , ('fish','fish')])   
    submit = SubmitField('Submit')

我在终端上得到的响应是:

Traceback (most recent call last):
  File "/Users/himanshu/Documents/MasterInt/HMSpython/controller.py", line 21, in <module>
    from form import infoForm
  File "/Users/himanshu/Documents/MasterInt/HMSpython/form.py", line 22
    food_option = SelectField(u'Pick your fav food: ', choices = [('chic','Chicken') , ('bf','beef') , ('fish','fish')])    
              ^

箭头在字'chic',

之后的下方

想了解我在遵循文档时哪里出错了吗?

谢谢!

你在无线电场和布尔场上的错误位置得到了右括号 ')'。您在选择之前关闭括号。也许这就是问题所在。 并在逗号之后而不是之前放一个 space。 你可以在下面看到我的意思。

class infoForm(FlaskForm):

    # Used by forms.py essentially  
    breed = StringField("What breed are you?", validators=[DataRequired()])
    neutered = BooleanField("Have you been neutered?", choices=['Yes'])
    mood = RadioField('Please choose your mood:', choices=[('mood_one', 'Happy'), ('mood_2', 'Sad')])
    food_option = SelectField(u'Pick your fav food:', choices=[('chic', 'Chicken'), ('bf', 'beef'), ('fish', 'fish')])   
    submit = SubmitField('Submit')