kexue-z / nonebot-plugin-heweather

MIT License
63 stars 11 forks source link

插件加载报错 #51

Closed ElainaFanBoy closed 1 year ago

ElainaFanBoy commented 1 year ago

更新了最新版nb和最新版插件就这样了

06-26 19:41:00 [ERROR] nonebot | Failed to import "nonebot_plugin_heweather" Traceback (most recent call last): File "D:\Desktop\0\software\wbushu\Bot\IRONY\bot.py", line 30, in nonebot.load_plugins("src/firstload") File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\load.py", line 48, in load_plugins return manager.load_all_plugins() File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins return set( File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 176, in filter(None, (self.load_plugin(name) for name in self.available_plugins))

File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 145, in load_plugin module = importlib.import_module( File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\importlib__init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 241, in exec_module super().exec_module(module) File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweather__init__.py", line 7, in from .render_pic import render File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweather\render_pic.py", line 11, in from .weather_data import Weather File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweather\weather_data.py", line 21, in class Weather: File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweather\weather_data.py", line 47, in Weather def init__(self, city_name: str, api_key: str, api_type: int | str = 0): TypeError: unsupported operand type(s) for |: 'type' and 'type'

ElainaFanBoy commented 1 year ago

更新了最新版nb和最新版插件就这样了

06-26 19:41:00 [ERROR] nonebot | Failed to import "nonebot_plugin_heweather" Traceback (most recent call last): File "D:\Desktop\0\software\wbushu\Bot\IRONY\bot.py", line 30, in nonebot.load_plugins("src/firstload") File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\load.py", line 48, in load_plugins return manager.load_all_plugins() File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins return set( File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 176, in filter(None, (self.load_plugin(name) for name in self.available_plugins))

File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 145, in load_plugin module = importlib.import_module( File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\importlibinit.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "D:\Desktop\0\software\wbushu\Bot\IRONY\env\lib\site-packages\nonebot\plugin\manager.py", line 241, in exec_module super().exec_module(module) File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweatherinit.py", line 7, in from .render_pic import render File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweather\render_pic.py", line 11, in from .weather_data import Weather File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweather\weather_data.py", line 21, in class Weather: File "D:\Desktop\0\software\wbushu\Bot\IRONY\src\firstload\nonebot_plugin_heweather\weather_data.py", line 47, in Weather def init(self, city_name: str, api_key: str, api_type: int | str = 0): TypeError: unsupported operand type(s) for |: 'type' and 'type'

好像是因为我是Py3.9的原因...

kexue-z commented 1 year ago

确实 用了3.10的语法,建议升级一下~

ElainaFanBoy commented 1 year ago

确实 用了3.10的语法,建议升级一下~

哎,一升级好多东西炸了,我再想想办法吧

ElainaFanBoy commented 1 year ago

确实 用了3.10的语法,建议升级一下~

我看pyproject.toml里还写着requires-python = ">=3.8,<4.0"就是试了下()

kexue-z commented 1 year ago

那你可以混个PR,把 | 的语法给换掉