今夕何夕2112 2021-12-16 23:30 采纳率: 75%
浏览 99
已结题

termux qqbot 报错,如何解决?

最后一行:
AttributeError: 'HTMLParser' object has no attribute 'unescape'
版本信息:
termux 0.117
MIUI: 12.5.7
python 3.10.0
qqbot 2.3.11
完整报错信息如下:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/bin/qqbot", line 33, in <module>
    sys.exit(load_entry_point('qqbot==2.3.11', 'console_scripts', 'qqbot')())
  File "/data/data/com.termux/files/usr/bin/qqbot", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/data/data/com.termux/files/usr/lib/python3.10/importlib/metadata/__init__.py", line 162, in load
    module = import_module(match.group('module'))
  File "/data/data/com.termux/files/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qqbot/__init__.py", line 3, in <module>
    from .qqbotcls import QQBot, QQBotSlot, QQBotSched, RunBot, _bot
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qqbot/qqbotcls.py", line 20, in <module>
    from qqbot.qconf import QConf
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qqbot/qconf.py", line 198, in <module>
    from qqbot.utf8logger import SetLogLevel, INFO, RAWINPUT, PRINT, ERROR
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qqbot/utf8logger.py", line 10, in <module>
    from qqbot.common import PY3
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/qqbot/common.py", line 184, in <module>
    import html.parser; htmlUnescape = html.parser.HTMLParser().unescape
AttributeError: 'HTMLParser' object has no attribute 'unescape'
  • 写回答

1条回答 默认 最新

  • 陈年椰子 2021-12-17 11:14
    关注

    库的定义改变了。修改一下用法

    img

        import html.parser; htmlUnescape = html.parser.HTMLParser().unescap
    
    

    改成

    import html.parser
    htmlUnescape = html.unescape
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 12月25日
  • 已采纳回答 12月17日
  • 创建了问题 12月16日

悬赏问题

  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下