bot-ssttkkl / nonebot-plugin-access-control

Nonebot 权限控制插件
MIT License
43 stars 2 forks source link

数据类型出错,导致插件加载失败 #3

Closed QuickLAW closed 1 year ago

QuickLAW commented 1 year ago

加载最新版本的插件时出现错误。

问题重现:安装插件后,nonebot加载插件时出错

上个月也没出现问题,这次重装机器人后不知道出错了。

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\QQrobot\QQrobot\bot.py", line 18, in <module>
    nonebot.load_from_toml("pyproject.toml")
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot\plugin\load.py", line 125, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot\plugin\load.py", line 62, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins
    return set(
  File "C:\ProgramData\Anaconda3\envs\robot\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:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin
    module = importlib.import_module(name)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot\plugin\manager.py", line 241, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\__init__.py", line 60, in <module>
    from .service import get_nonebot_service
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\__init__.py", line 1, in <module>
    from .base import Service
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\base.py", line 12, in <module>
    from .impl.permission import ServicePermissionImpl
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\impl\permission.py", line 7, in <module>
    from ..interface.permission import IServicePermission
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\interface\__init__.py", line 1, in <module>
    from .service import IService
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\interface\service.py", line 5, in <module>
    from .permission import IServicePermission
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\interface\permission.py", line 4, in <module>
    from nonebot_plugin_access_control.event_bus import T_Listener
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\event_bus.py", line 38, in <module>
    T_Filter = Callable[[...], bool]
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 829, in __getitem__
    return self.__getitem_inner__(params)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 243, in inner
    return func(*args, **kwds)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 839, in __getitem_inner__
    args = tuple(_type_check(arg, msg) for arg in args)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 839, in <genexpr>
    args = tuple(_type_check(arg, msg) for arg in args)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 151, in _type_check
    raise TypeError(f"{msg} Got {arg!r:.100}.")
TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.
ssttkkl commented 1 year ago

你的python版本是多少?

ssttkkl commented 1 year ago

似乎是python3.8会有这个问题,发了个0.5.7尝试修了这个问题,你可以试一下(但是我没复现所以我也不知道修好了没)

QuickLAW commented 1 year ago

你的python版本是多少?

首先十分感谢大佬,python版本为3.9.0,虽然即便是0.5.7版本也依旧存在相同的问题,但是有所改变,问题变到了第44行的代码

  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\interface\service.py", line 5, in <module>
    from .permission import IServicePermission
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\service\interface\permission.py", line 4, in <module>
    from nonebot_plugin_access_control.event_bus import T_Listener
  File "C:\ProgramData\Anaconda3\envs\robot\lib\site-packages\nonebot_plugin_access_control\event_bus.py", line 44, in <module>
    def _call_with_kwargs(func: Callable[[...], T], kwargs: T_Kwargs) -> T:
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 829, in __getitem__
    return self.__getitem_inner__(params)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 243, in inner
    return func(*args, **kwds)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 839, in __getitem_inner__
    args = tuple(_type_check(arg, msg) for arg in args)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 839, in <genexpr>
    args = tuple(_type_check(arg, msg) for arg in args)
  File "C:\ProgramData\Anaconda3\envs\robot\lib\typing.py", line 151, in _type_check
    raise TypeError(f"{msg} Got {arg!r:.100}.")
TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.
ssttkkl commented 1 year ago

TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.

还有一处忘记改了() 0.5.7.post1试试

QuickLAW commented 1 year ago

TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.

还有一处忘记改了() 0.5.7.post1试试

谢谢大佬,已经可以了,十分感谢!