CMHopeSunshine / LittlePaimon

小派蒙!基于Nonebot2的原神机器人,包括但不限于UID面板查询、抽卡记录分析、游戏攻略图鉴、实时便签、原石札记、群聊学习、群管等功能。/ LittlePamon! Genshin Impact multifunctional bot based on Nonebot2.
https://docs.paimon.cherishmoon.top
GNU Affero General Public License v3.0
1.15k stars 127 forks source link

启动时报错Failed to import "nonebot_plugin_apscheduler" #310

Closed 19231224lhr closed 1 year ago

19231224lhr commented 2 years ago

我将很多其他插件也加进了小派蒙,但是启动后出现这个问题 image

主要插件的报错 image image 好像调用了nonebot_plugin_apscheduler插件的都报错了呜呜 image

其实我自己建的机器人也遇到了这个问题,好像是因为版本的问题,于是我尝试了pip install --upgrade nonebot_plugin_apscheduler,最后问题就解决了,但是在小派蒙项目中,我这样执行还是有问题呜呜

这是我加入的插件 image

CMHopeSunshine commented 2 years ago

试试在load_plugin("LittlePaimon")上一行加一句load_plugin("nonebot_plugin_apscheduler")

19231224lhr commented 2 years ago

试试在load_plugin("LittlePaimon")上一行加一句load_plugin("nonebot_plugin_apscheduler")

还是报了一样的错呜呜

image image

CMHopeSunshine commented 2 years ago

更新一下版本,poetry run pip install nonebot-plugin-apscheduler -U

19231224lhr commented 2 years ago

好的,我马上去试

---原始邮件--- 发件人: @.> 发送时间: 2022年10月21日(周五) 上午10:13 收件人: @.>; 抄送: @.**@.>; 主题: Re: [CMHopeSunshine/LittlePaimon] 启动时报错Failed to import "nonebot_plugin_apscheduler" (Issue #310)

ERICK886 commented 1 year ago

PS C:\Paimon\LittlePaimon> & C:/Python311/python.exe c:/Paimon/LittlePaimon/bot.py 12-19 11:22:35 [SUCCESS] nonebot | NoneBot is initializing... 12-19 11:22:35 [INFO] nonebot | Current Env: prod 12-19 11:22:35 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_couplets" 12-19 11:22:35 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_apscheduler" 12-19 11:22:35 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_myb_exchange" 12-19 11:22:35 [ERROR] nonebot | Failed to import "LittlePaimon" Traceback (most recent call last): File "c:\Paimon\LittlePaimon\bot.py", line 28, in nonebot.load_plugin("LittlePaimon") File "C:\Python311\Lib\site-packages\nonebot\plugin\load.py", line 34, in load_plugin return manager.load_plugin(module_path)

File "C:\Python311\Lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin module = importlib.import_module(name) File "C:\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:\Python311\Lib\site-packages\nonebot\plugin\manager.py", line 233, in exec_module super().exec_module(module) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "c:\Paimon\LittlePaimon\LittlePaimon__init.py", line 5, in from LittlePaimon import database, web File "c:\Paimon\LittlePaimon\LittlePaimon\database\init.py", line 9, in from .models import * File "c:\Paimon\LittlePaimon\LittlePaimon\database\models\init.py", line 1, in from .character import * File "c:\Paimon\LittlePaimon\LittlePaimon\database\models\character.py", line 5, in from tortoise import fields ImportError: cannot import name 'fields' from 'tortoise' (C:\Python311\Lib\site-packages\tortoise\init.py) 12-19 11:22:35 [WARNING] main__ | Always use nb run to start the bot instead of manually running! 12-19 11:22:35 [SUCCESS] nonebot | Running NoneBot... 12-19 11:22:35 [INFO] logging | Started server process [23828] 12-19 11:22:35 [INFO] logging | Waiting for application startup. 12-19 11:22:35 [INFO] nonebot_plugin_apscheduler | Scheduler Started 12-19 11:22:35 [INFO] LittlePaimon | Scheduler Started 12-19 11:22:35 [INFO] logging | Application startup complete. 12-19 11:22:35 [INFO] logging | Uvicorn running on http://0.0.0.0:13579 (Press CTRL+C to quit) 12-19 11:22:38 [INFO] logging | ('127.0.0.1', 55687) - "WebSocket /onebot/v11/ws" [accepted] 12-19 11:22:38 [INFO] nonebot | OneBot V11 | Bot 2559987819 connected 12-19 11:22:38 [INFO] logging | connection open

ERICK886 commented 1 year ago

PS C:\Paimon\LittlePaimon> & C:/Python311/python.exe c:/Paimon/LittlePaimon/bot.py 12-19 11:22:35 [SUCCESS] nonebot | NoneBot is initializing... 12-19 11:22:35 [INFO] nonebot | Current Env: prod 12-19 11:22:35 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_couplets" 12-19 11:22:35 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_apscheduler" 12-19 11:22:35 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_myb_exchange" 12-19 11:22:35 [ERROR] nonebot | Failed to import "LittlePaimon" Traceback (most recent call last): File "c:\Paimon\LittlePaimon\bot.py", line 28, in nonebot.load_plugin("LittlePaimon") File "C:\Python311\Lib\site-packages\nonebot\plugin\load.py", line 34, in load_plugin return manager.load_plugin(module_path)

File "C:\Python311\Lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin module = importlib.import_module(name) File "C:\Python311\Lib\importlibinit.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:\Python311\Lib\site-packages\nonebot\plugin\manager.py", line 233, in exec_module super().exec_module(module) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "c:\Paimon\LittlePaimon\LittlePaimoninit.py", line 5, in from LittlePaimon import database, web File "c:\Paimon\LittlePaimon\LittlePaimon\databaseinit.py", line 9, in from .models import File "c:\Paimon\LittlePaimon\LittlePaimon\database\models_init.py", line 1, in from .character import File "c:\Paimon\LittlePaimon\LittlePaimon\database\models\character.py", line 5, in from tortoise import fields ImportError: cannot import name 'fields' from 'tortoise' (C:\Python311\Lib\site-packages\tortoise_init.py) 12-19 11:22:35 [WARNING] main | Always use nb run to start the bot instead of manually running! 12-19 11:22:35 [SUCCESS] nonebot | Running NoneBot... 12-19 11:22:35 [INFO] logging | Started server process [23828] 12-19 11:22:35 [INFO] logging | Waiting for application startup. 12-19 11:22:35 [INFO] nonebot_plugin_apscheduler | Scheduler Started 12-19 11:22:35 [INFO] LittlePaimon | Scheduler Started 12-19 11:22:35 [INFO] logging | Application startup complete. 12-19 11:22:35 [INFO] logging | Uvicorn running on http://0.0.0.0:13579 (Press CTRL+C to quit) 12-19 11:22:38 [INFO] logging | ('127.0.0.1', 55687) - "WebSocket /onebot/v11/ws" [accepted] 12-19 11:22:38 [INFO] nonebot | OneBot V11 | Bot 2559987819 connected 12-19 11:22:38 [INFO] logging | connection open__

这个是什么问题呀,我用了poetry install也没用

CMHopeSunshine commented 1 year ago

是否在bot目录中运行的呢?使用的启动命令是什么