简体   繁体   English

SyntaxError:使用 flask_wtf package 时语法无效

[英]SyntaxError: invalid syntax while using flask_wtf package

I tried to use the flask_wtf in my python2 script but i get this error我试图在我的 python2 脚本中使用 flask_wtf 但我收到了这个错误

    File "bartender.py", line 16, in <module>
    from flask_wtf import FlaskForm
  File "/usr/local/lib/python2.7/dist-packages/flask_wtf/__init__.py", line 1, in <module>
    from .csrf import CSRFProtect, CsrfProtect
  File "/usr/local/lib/python2.7/dist-packages/flask_wtf/csrf.py", line 220
    dest = f'{view.__module__}.{view.__name__}'
                                              ^
SyntaxError: invalid syntax

here is my import line这是我的导入行

from flask import Flask, render_template, jsonify, request, redirect, url_for
from multiprocessing import Process
from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField
from wtforms.validators import NumberRange, Length

I know python3 is out and we should use this but this is a very ols script from me and i tried to extend it and I also do a python3 portation:)我知道 python3 已经过时了,我们应该使用它,但这是我的一个非常 ols 的脚本,我试图扩展它,我也做了一个 python3 移植:)

This should work这应该工作

pip install flask-wtf==0.14.3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM