Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文档,包名错误,导致一直报错 #27

Closed
mmxd12 opened this issue Aug 7, 2024 · 4 comments
Closed

文档,包名错误,导致一直报错 #27

mmxd12 opened this issue Aug 7, 2024 · 4 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@mmxd12
Copy link

mmxd12 commented Aug 7, 2024

`08-07 20:22:32 [ERROR] nonebot | Failed to import "nonebot_plugin_eventmonitor"
Traceback (most recent call last):
File "/root/wfbot/bot.py", line 14, in
nonebot.load_from_toml("pyproject.toml")
File "/usr/local/lib/python3.10/dist-packages/nonebot/plugin/load.py", line 131, in load_from_toml
return load_all_plugins(plugins, plugin_dirs)
File "/usr/local/lib/python3.10/dist-packages/nonebot/plugin/load.py", line 65, in load_all_plugins
return manager.load_all_plugins()
File "/usr/local/lib/python3.10/dist-packages/nonebot/plugin/manager.py", line 203, in load_all_plugins
return set(
File "/usr/local/lib/python3.10/dist-packages/nonebot/plugin/manager.py", line 204, in
filter(None, (self.load_plugin(name) for name in self.available_plugins))

File "/usr/local/lib/python3.10/dist-packages/nonebot/plugin/manager.py", line 167, in load_plugin
module = importlib.import_module(self._third_party_plugin_ids[name])
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "/usr/local/lib/python3.10/dist-packages/nonebot/plugin/manager.py", line 255, in exec_module
super().exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/usr/local/lib/python3.10/dist-packages/nonebot_plugin_eventmonitor/init.py", line 16, in
require("nonebot_plugin_apscheduler")
File "/usr/local/lib/python3.10/dist-packages/nonebot/plugin/load.py", line 188, in require
raise RuntimeError(f'Cannot load plugin "{name}"!')
RuntimeError: Cannot load plugin "nonebot_plugin_apscheduler"!`
这里存在两个包名"nonebot_plugin_eventmonitor"和"nonebot_plugin_apscheduler"
而且文档有很多写不一样的
1

@mmxd12 mmxd12 closed this as completed Aug 7, 2024
@Reversedeer
Copy link
Owner

Reversedeer commented Aug 7, 2024

在pypi中包名是
nonebot-plugin-eventmonitor但在导入插件时必须使用"_"
pip 安装包时无影响
报错主要原因是可能重复导入的两次相同的包或者没有导入。默认安装在site-packages里
使用nb命令安装时会自动在pyproject.py中写入相关信息,使用pip安装需要手动在pyproject.py中添加
如果你将本插件放在/src中则按照readme中的指引完成

@Reversedeer
Copy link
Owner

文档确实有欠缺,后续会改进

@Reversedeer
Copy link
Owner

请问你是否解决了问题呢

@Reversedeer
Copy link
Owner

已更新v0.3.2

@Reversedeer Reversedeer added bug Something isn't working documentation Improvements or additions to documentation labels Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants