18870 / nonebot-plugin-reboot

命令重启 nonebot2
MIT License
17 stars 0 forks source link

RuntimeError #7

Open LittleChest opened 1 year ago

LittleChest commented 1 year ago

使用的是aiohttp驱动器,也在.env配置了

fastapi_reload=False

控制台输出:

07-10 17:29:35 [SUCCESS] nonebot | NoneBot is initializing...
07-10 17:29:35 [INFO] nonebot | Current Env: prod
07-10 17:29:36 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_reboot"
07-10 17:29:36 [ERROR] nonebot | Failed to import "KPM"
Traceback (most recent call last):
  File "C:\Users\LittleChest\OneDrive\桌面\KOOK\bot.py", line 9, in <module>
    nonebot.load_from_toml("pyproject.toml")
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\load.py", line 125, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\load.py", line 62, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins
    return set(
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 176, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 145, in load_plugin
    module = importlib.import_module(
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 241, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\LittleChest\OneDrive\桌面\KOOK\plugins\KPM\__init__.py", line 114, in <module>
    Reloader.reload(delay=86400)
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot_plugin_reboot\reloader.py", line 18, in reload
    raise RuntimeError()
RuntimeError
07-10 17:29:36 [SUCCESS] nonebot | NoneBot is initializing...
07-10 17:29:36 [INFO] nonebot | Current Env: prod
07-10 17:29:37 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_reboot"
07-10 17:29:37 [ERROR] nonebot | Failed to import "KPM"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\multiprocessing\spawn.py", line 120, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\multiprocessing\spawn.py", line 129, in _main
    prepare(preparation_data)
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\multiprocessing\spawn.py", line 240, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\LittleChest\OneDrive\桌面\KOOK\bot.py", line 9, in <module>
    nonebot.load_from_toml("pyproject.toml")
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\load.py", line 125, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\load.py", line 62, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins
    return set(
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 176, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 145, in load_plugin
    module = importlib.import_module(
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot\plugin\manager.py", line 241, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\LittleChest\OneDrive\桌面\KOOK\plugins\KPM\__init__.py", line 114, in <module>
    Reloader.reload(delay=86400)
  File "C:\Users\LittleChest\AppData\Local\Programs\Python\Lib\site-packages\nonebot_plugin_reboot\reloader.py", line 18, in reload
    raise RuntimeError()
RuntimeError
07-10 17:29:37 [SUCCESS] nonebot | Running NoneBot...
07-10 17:29:37 [INFO] nonebot | Application startup completed.
18870 commented 1 year ago

不支持在插件加载阶段调用 Reloader.reload