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

【报错】Current driver does not support http client #69

Closed
wdssqc1 opened this issue Dec 26, 2023 · 2 comments
Closed

【报错】Current driver does not support http client #69

wdssqc1 opened this issue Dec 26, 2023 · 2 comments

Comments

@wdssqc1
Copy link

wdssqc1 commented Dec 26, 2023

我是在windows下用的真寻bot,直接在虚拟环境内pip安装并在bot.py加入了nonebot.load_plugin("nonebot_plugin_memes"),部分表情可以生成,部分就会报错,具体如下,烦请大佬们帮帮看看,谢谢

12-27 01:28:21 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_memes, lineno=337) failed.
Traceback (most recent call last):
  File "D:\Bot\zhenxun_bot-main\bot.py", line 24, in <module>
    nonebot.run()
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\__init__.py", line 331, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\drivers\fastapi.py", line 201, in run
    uvicorn.run(
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 634, in run_until_complete
    self.run_forever()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 601, in run_forever
    self._run_once()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1905, in _run_once
    handle._run()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 846, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 821, in simple_run
    await handler(
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\dependencies\__init__.py", line 113, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot_plugin_memes\__init__.py", line 327, in handle
    await process(matcher, meme, image_sources, texts, user_infos, args)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot_plugin_memes\__init__.py", line 239, in process
    images.append(await image_source.get_image())
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot_plugin_memes\depends.py", line 30, in get_image
    result = await image_fetch(self.event, self.bot, self.state, self.img)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot_plugin_alconna\uniseg\tools.py", line 32, in image_fetch
    resp = await bot.adapter.request(req)
  File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-bYKVLPn4-py3.9\lib\site-packages\nonebot\internal\adapter\adapter.py", line 89, in request
    raise TypeError("Current driver does not support http client")
TypeError: Current driver does not support http client
@MeetWq
Copy link
Member

MeetWq commented Dec 27, 2023

在 env 文件中修改 driver 配置,加入 httpx,如:

DRIVER=~fastapi+~websockets+~httpx

@wdssqc1
Copy link
Author

wdssqc1 commented Dec 27, 2023

谢谢大佬,解决了

在 env 文件中修改 driver 配置,加入 httpx,如:

DRIVER=~fastapi+~websockets+~httpx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants