Closed youyi0218 closed 3 weeks ago
后面的日志 File "D:\Program\zhenxun_bot\services\db_context.py", line 56, in init await Tortoise.generate_schemas() File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise__init.py", line 640, in generate_schemas await generate_schema_for_client(connection, safe) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\utils.py", line 31, in generate_schema_for_client await generator.generate_from_string(schema) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\base\schema_generator.py", line 448, in generate_from_string await self.client.execute_script(creation_string) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\base_postgres\client.py", line 34, in _translate_exceptions return await self._translate_exceptions(func, *args, *kwargs) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\asyncpg\client.py", line 82, in _translate_exceptions return await func(self, args, **kwargs) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\base_postgres\client.py", line 150, in execute_script async with self.acquire_connection() as connection: File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\base\client.py", line 326, in aenter await self.ensure_connection() File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\base\client.py", line 322, in ensure_connection await self.client.create_connection(with_db=True) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\asyncpg\client.py", line 59, in create_connection self._pool = await self.create_pool(password=self.password, self._template) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\tortoise\backends\asyncpg\client.py", line 65, in create_pool return await asyncpg.create_pool(None, kwargs) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\pool.py", line 403, in _asyncinit await self._initialize() File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\pool.py", line 430, in _initialize await first_ch.connect() File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\pool.py", line 128, in connect self._con = await self._pool._get_new_connection() File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\pool.py", line 502, in _get_new_connection con = await connection.connect( File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\connection.py", line 2329, in connect return await connect_utils._connect( File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\connect_utils.py", line 1017, in _connect raise last_error or exceptions.TargetServerAttributeNotMatched( File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\connect_utils.py", line 991, in _connect conn = await _connect_addr( File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\connect_utils.py", line 828, in _connect_addr return await connect_addr(params, True, args) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\connect_utils.py", line 873, in __connect_addr tr, pr = await connector File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\asyncpg\connect_utils.py", line 744, in _create_ssl_connection tr, pr = await loop.create_connection( File "D:\python\3.10.11\lib\asyncio\base_events.py", line 1036, in create_connection infos = await self._ensure_resolved( File "D:\python\3.10.11\lib\asyncio\base_events.py", line 1418, in _ensure_resolved return await loop.getaddrinfo(host, port, family=family, type=type, File "D:\python\3.10.11\lib\asyncio\base_events.py", line 863, in getaddrinfo return await self.run_in_executor( File "D:\python\3.10.11\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(self.args, **self.kwargs) File "D:\python\3.10.11\lib\socket.py", line 955, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\starlette\routing.py", line 734, in lifespan async with self.lifespan_context(app) as maybe_state: File "D:\python\3.10.11\lib\contextlib.py", line 199, in aenter return await anext(self.gen) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\nonebot\drivers\fastapi.py", line 152, in _lifespan_manager await self._lifespan.startup() File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\nonebot\internal\driver_lifespan.py", line 41, in startup await self._run_lifespan_func(self._startup_funcs) File "C:\Users\youyi\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-R0qD1gnV-py3.10\lib\site-packages\nonebot\internal\driver_lifespan.py", line 35, in _run_lifespan_func await cast(ASYNC_LIFESPAN_FUNC, func)() File "D:\Program\zhenxun_bot\services\db_context.py", line 59, in init raise Exception(f"数据库连接错误.... {type(e)}: {e}") Exception: 数据库连接错误.... <class 'socket.gaierror'>: [Errno 11001] getaddrinfo failed
02-10 21:34:58 [ERROR] uvicorn | Application startup failed. Exiting.
我也遇见了,通过降低nonebot2版本到2.0.0rc3解决了。
系统版本:win10
真寻版本:0.1.6.7
日志截图
[img]
![image](https://github.com/HibiKier/zhenxun_bot/assets/135406843/3b6f5e17-3b9d-4fce-a33a-0995c90d0a51)
错误说明
如标题和图