Kyomotoi / ATRI

A project for ATRI, use go-cqhttp and Nonebot2.
https://atri.imki.moe
GNU General Public License v3.0
722 stars 87 forks source link

是否无法与其他nonebot的机器人同时使用? #80

Closed fatinghenji closed 1 year ago

fatinghenji commented 1 year ago

描述问题 | Describe the question RT,在解决了一大票的python包的问题后,我发现无法启动bot,是因为无法和其他同样使用nonebot框架的机器人一同使用吗?

补充内容 | Additional context 启动报错如下:

ATRI | 02-12 16:37:44 | ERROR uvicorn >> Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.suroot/.cache/pypoetry/virtualenvs/atri-IWL-4cR8-py3.8/lib/python3.8/site-packages/starlette/routing.py", line 671, in lifespan
    async with self.lifespan_context(app):
  File "/data/data/com.termux/files/home/.suroot/.cache/pypoetry/virtualenvs/atri-IWL-4cR8-py3.8/lib/python3.8/site-packages/starlette/routing.py", line 566, in __aenter__
    await self._router.startup()
  File "/data/data/com.termux/files/home/.suroot/.cache/pypoetry/virtualenvs/atri-IWL-4cR8-py3.8/lib/python3.8/site-packages/starlette/routing.py", line 650, in startup
    handler()
  File "/data/data/com.termux/files/home/ATRI/ATRI/plugins/console/driver/__init__.py", line 51, in init_driver
    register_driver(driver())  # type: ignore
  File "/data/data/com.termux/files/home/ATRI/ATRI/plugins/console/driver/__init__.py", line 19, in register_driver
    app.add_middleware(
  File "/data/data/com.termux/files/home/.suroot/.cache/pypoetry/virtualenvs/atri-IWL-4cR8-py3.8/lib/python3.8/site-packages/starlette/applications.py", line 135, in add_middleware
    raise RuntimeError("Cannot add middleware after an application has started")
RuntimeError: Cannot add middleware after an application has started
fatinghenji commented 1 year ago

~又是一个自问自答.jpg~ 在其他项目中找到了相同的问题,解决方法为:降级fastapi版本,可以正常使用的版本为:0.90.1 具体命令行(在peotry shell中)

pip uninstall fastapi
pip install fastapi==0.90.1
Kyomotoi commented 1 year ago

你猜我为什么用 poetry

fatinghenji commented 1 year ago

不开新issue了,借楼问kimo怎么用(不管是否是@了 bot都没用啊