jhao104 / jhao104/proxy_pool

Python 3.8需要升级Werkzeug依赖,否则提示type_ignores错误

Open
#473 2 comments 18 reactions 0 assignees View on GitHub
dependencies
Dominant language
Python
Stars
23.7k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

使用Python 3.8, Werkzeug 0.15.3时会提示如下错误:
```
Traceback (most recent call last):
File "proxyPool.py", line 19, in
from api.proxyApi import runFlask
File "/home/louis/wenshu/proxy_pool/api/proxyApi.py", line 27, in
app = Flask(__name__)
File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/flask/app.py", line 556, in __init__
self.add_url_rule(
File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/flask/app.py", line 64, in wrapper_func
return f(self, *args, **kwargs)
File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/flask/app.py", line 1214, in add_url_rule
self.url_map.add(rule)
File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 1386, in add
rule.bind(self)
File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 730, in bind
self.compile()
File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 794, in compile
self._build = self._compile_builder(False).__get__(self, None)
File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 945, in _compile_builder
code = compile(module, "", "exec")
TypeError: required field "type_ignores" missing from Module
```

经查询,此问题在许多使用Flask的程序中都有,解决方法为升级Werkzeug至 0.15.5 或更高。(我尝试了`pip install Werkzeug==0.16.0`),成功解决。

可参见:
https://github.com/pjialin/py12306/issues/355
https://github.com/WhaleShark-Team/cobra/issues/1382
等。

建议修改`requirements.txt`中版本要求。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.