benx1n / HikariBot

战舰世界HikariBot,支持战绩查询,基于Nonebot2全平台兼容
MIT License
181 stars 24 forks source link

更新到0.3.9.1之后无法载入插件 #49

Closed veadex closed 1 year ago

veadex commented 1 year ago

更到0.3.9.1之后无法启动插件,Python版本是3.11 代码如下

`05-11 13:12:39 [ERROR] nonebot | Failed to import "hikari_bot" Traceback (most recent call last): File "C:\Users\Administrator\Desktop\test\first\bot.py", line 18, in nonebot.load_from_toml("pyproject.toml") File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\load.py", line 125, in load_from_toml return load_all_plugins(plugins, plugin_dirs) File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\load.py", line 62, in load_all_plugins return manager.load_all_plugins() File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins return set( File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 176, in filter(None, (self.load_plugin(name) for name in self.available_plugins))

File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin module = importlib.import_module(name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\importlib__init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\nonebot\plugin\manager.py", line 240, in exec_module super().exec_module(module) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot\init__.py", line 29, in from .command_select import select_command File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot\command_select.py", line 4, in from .game.ban_search import get_BanInfo File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot\game\ban_search.py", line 13, in from ..HttpClient_pool import client_yuyuko File "C:\Users\Administrator\Desktop\test\first.venv\Lib\site-packages\hikari_bot\HttpClient_pool.py", line 31, in http2 = config.http2 AttributeError: 'Config' object has no attribute 'http2'`

在将这个路径 C:\Users\Administrator\Desktop\test\first\.venv\Lib\site-packages\hikari_bot\HttpClient_pool.py下的 http2 = config.http2改为 http2 = getattr(config, 'http2', None)之后可以载入了

veadex commented 1 year ago

我是问chatgpt给的方法改的,我不会代码

benx1n commented 1 year ago

正常不该出现这个情况,因为.env中已经包含了默认配置 通过wws 更新Hikari指令更新上去的会自动下载最新的配置文件 解决也很简单 env.prod中加入http2 = true