Closed suchocolate closed 3 years ago
可以列一下依赖看看有没有 email-validator:
$ pip list
或是:
$ pip show email-validator
如果创建了虚拟环境,确保激活以后再安装:
$ pip install email-validator
感谢回复 上次安装完email-validator之后,flask已经跑起来了,访问 http://192.168.70.138:5000/html报错如下(192.168.70.138是我的Ubuntu1404虚机的IP): `AttributeError
AttributeError: 'module' object has no attribute 'IntFlag' Traceback (most recent call last)
File "/root/helloflask-master/demos/form/app.py", line 12, in <module>
from flask_ckeditor import CKEditor, upload_success, upload_fail
File "/usr/local/lib/python3.4/dist-packages/flask_ckeditor/__init__.py", line 14, in <module>
from flask_ckeditor.fields import CKEditorField # noqa
File "/usr/local/lib/python3.4/dist-packages/flask_ckeditor/fields.py", line 11, in <module>
from wtforms import TextAreaField
File "/usr/local/lib/python3.4/dist-packages/wtforms/__init__.py", line 11, in <module>
from wtforms import validators, widgets
File "/usr/local/lib/python3.4/dist-packages/wtforms/validators.py", line 9, in <module>
import email_validator
File "/usr/local/lib/python3.4/dist-packages/email_validator/__init__.py", line 6, in <module>
import dns.resolver
File "/usr/local/lib/python3.4/dist-packages/dns/resolver.py", line 32, in <module>
import dns.flags
File "/usr/local/lib/python3.4/dist-packages/dns/flags.py", line 24, in <module>
class Flag(enum.IntFlag):
AttributeError: 'module' object has no attribute 'IntFlag'
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object`
如果和书相关,给出相关页数/程序/代码片段编号等信息 第4章 表单示例程序 helloflask/demos/form/ 给出使用的操作系统、Python 版本、Flask 版本 Ubuntu1404 Python 3.4.3 Flask 1.1.2
估计是 Python 版本问题,可以升级下试试看。因为和原 issue 无关,可以重开一个 issue,这个先关闭了。
请确保提供下面的信息:
Exception: Install 'email_validator' for email validation support. Traceback (most recent call last)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter. `
第4章 表单示例程序 helloflask/demos/form/
Ubuntu1404 Python 2.7.6 Flask 1.1.2