gpt4 book ai didi

python - CherryPy属性错误: 'Module_six_moves_urllib_parse' object has no attribute 'unquote _to_bytes'

转载 作者:行者123 更新时间:2023-12-01 08:22:46 25 4
gpt4 key购买 nike

我正在尝试使用cherryPy,但在访问网页时显示以下错误:AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'unquote_to_bytes'。我已经检查了模块 Six.moves urllib_parse 具有名为 unquote_to_bytes 的属性,但 Cherrypy 仍然显示此错误。服务器正常启动,但仅在通过键入 url 访问网页时才会显示此错误。下面是从cherrypy基础教程中复制的代码,只是修改了IP和端口号:

import cherrypy
import globals


class HelloWorld(object):
@cherrypy.expose
def index(self):
return "Hello World!"


cherrypy.config.update({'server.socket_host': "192.168.10.11",
'server.socket_port': 8088,
})
cherrypy.quickstart(HelloWorld())

这是实际的回溯:

[04/Feb/2019:20:26:23] ENGINE
AttributeError("'Module_six_moves_urllib_parse' object has no attribute 'unquote_to_bytes'",)
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/cheroot/server.py", line 1242, in communicate req.parse_request()
File "/usr/local/lib/python3.4/dist-packages/cheroot/server.py", line 712, in parse_request
success = self.read_request_line()
File "/usr/local/lib/python3.4/dist-packages/cheroot/server.py", line 912, in read_request_line for x in QUOTED_SLASH_REGEX.split(path)
File "/usr/local/lib/python3.4/dist-packages/cheroot/server.py", line 912, in <listcomp> for x in QUOTED_SLASH_REGEX.split(path)AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'unquote
_to_bytes'

最佳答案

我遇到了类似的错误,并注意到目前 CherryPy 和 cheroot 版本确实发挥了重要作用。

我的修复如下:

pip uninstall CherryPy

pip install --force-reinstall CherryPy==18.1.0

pip uninstall cheroot

pip install --force-reinstall cheroot==6.5.4

我希望这也适合您。

关于python - CherryPy属性错误: 'Module_six_moves_urllib_parse' object has no attribute 'unquote _to_bytes' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54516369/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com