When trying to create a simple login form using Flask and Flask-wtf,
confirm_password=Password('Password', validators=[DataRequired(), EqualTo(')])
^
TabError: inconsistent use of tabs and spaces in indication
An error similar to
occurred.I understand that the error is caused by tabs and indentation, but no matter how many times I fix it, it looks like this. - will occur.
How can we solve this problem?Please give me an answer.
Below is the code where the error occurred.
from flash_wtf import FlashForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, Email
class RegistrationForm (FlaskForm):
username=StringField('username', validators=[DataRequired(), Length(min=2, max=20)])
email=StringField('Email', validators=[DataRequired(), Email()])
password=PasswordField('Password', validators=[DataRequired()])
confirm_password=Password('Password', validators=[DataRequired(), EqualTo(')])
submit=SubmitField('Sign Up')
class LoginForm (FlaskForm):
email=StringField('Email', validators=[DataRequired(), Email()])
password=PasswordField('password', validators=[DataRequired()])
remember=BooleanField('Remember Me')
submit=SubmitField('Login')
python
flask
TabError
Sent when using tabs and spaces for indentation in an inconsistent manner.
https://docs.python.jp/3/library/exceptions.html#TabError
This occurs when both tabs and spaces are used to indent the code.
However, as far as the source code is concerned, the tab does not appear to exist (Stack Overflow problem?).
confirm_password
is mixed, so check and removecat-e file|less
allows you to view tabs as characters instead of spaces, and so on.confirm_password
is mixed, so check and removecat-e file|less
allows you to view tabs as characters instead of spaces, and so on.
© 2024 OneMinuteCode. All rights reserved.