nonebot / plugin-apscheduler

APScheduler Support for NoneBot2
https://nonebot.dev/docs/best-practice/scheduler
MIT License
85 stars 10 forks source link

使用本模块后报错 Module nonebot_plugin_apscheduler is not loaded as a plugin #56

Closed syvshc closed 6 days ago

syvshc commented 1 week ago

python 版本 3.12.4 nb: nonebot cli version 1.4.2

错误为

11-18 14:46:53 [ERROR] nonebot | Failed to import "nonebot_plugin_apscheduler"
Traceback (most recent call last):
  File "<string>", line 12, in <module>
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\load.py", line 131, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\load.py", line 65, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\manager.py", line 203, in load_all_plugins
    return set(
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\manager.py", line 204, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\manager.py", line 167, in load_plugin
    module = importlib.import_module(self._third_party_plugin_ids[name])
  File "D:\ProgramData\miniconda3\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\manager.py", line 255, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot_plugin_what2eat\__init__.py", line 17, in <module>
    require("nonebot_plugin_apscheduler")
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\load.py", line 185, in require
    plugin = load_plugin(name)
  File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\load.py", line 40, in load_plugin
    return manager.load_plugin(module_path)
> File "C:\Users\syvshc-lily\qqbot\.venv\Lib\site-packages\nonebot\plugin\manager.py", line 182, in load_plugin
    raise RuntimeError(
RuntimeError: Module nonebot_plugin_apscheduler is not loaded as a plugin! Make sure not to import it before loading.
yanyongyu commented 1 week ago

你别的插件在导入apscheduler插件时没有 require。请检查其他插件是否正确使用了插件依赖。