SamuNatsu / nonebot-plugin-deer-pipe

一个🦌管签到插件
GNU Affero General Public License v3.0
10 stars 4 forks source link

【BUG】九月第一天报错 #8

Closed Momoi-coder closed 1 month ago

Momoi-coder commented 1 month ago

报错如下: 09-01 00:42:34 [INFO] nonebot | Event will be handled by AlconnaMatcher(type='', module=nonebot_plugin_deer_pipe, lineno=29) 2024-09-01 00:42:34,747 INFO sqlalchemy.engine.Engine BEGIN (implicit) 2024-09-01 00:42:34,748 INFO sqlalchemy.engine.Engine SELECT user.id, user.year, user.month FROM user WHERE user.id = ? 2024-09-01 00:42:34,748 INFO sqlalchemy.engine.Engine [cached since 344.9s ago] ('1828074974',) 2024-09-01 00:42:34,750 INFO sqlalchemy.engine.Engine DELETE FROM userdeer WHERE userdeer.user_id = ? 2024-09-01 00:42:34,750 INFO sqlalchemy.engine.Engine [cached since 344.9s ago] ('1828074974',) 2024-09-01 00:42:34,753 INFO sqlalchemy.engine.Engine INSERT INTO user (year, month) VALUES (?, ?) 2024-09-01 00:42:34,753 INFO sqlalchemy.engine.Engine [cached since 344.9s ago] (2024, 9) 2024-09-01 00:42:34,754 INFO sqlalchemy.engine.Engine ROLLBACK 09-01 00:42:34 [INFO] nonebot | AlconnaMatcher(type='', module=nonebot_plugin_deer_pipe, lineno=29) running complete 09-01 00:42:34 [ERROR] nonebot | Running AlconnaMatcher(type='', module=nonebot_plugin_deer_pipe, lineno=29) failed. Traceback (most recent call last): File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\default.py", line 941, in do_execute cursor.execute(statement, parameters) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 147, in execute self._adapt_connection._handle_exception(error) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 298, in _handleexception raise error File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 129, in execute self.await(_cursor.execute(operation, parameters)) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 196, in greenlet_spawn value = await result File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 48, in execute await self._execute(self._cursor.execute, sql, parameters) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 40, in _execute return await self._conn._execute(fn, *args, **kwargs) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 132, in _execute return await future File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 115, in run result = function() sqlite3.IntegrityError: NOT NULL constraint failed: user.id

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\Desktop\Momoi bot\lhcbot\bot.py", line 46, in nonebot.run(app="__mp_main:app") File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\init__.py", line 335, in run get_driver().run(*args, *kwargs) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run uvicorn.run( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\main.py", line 575, in run server.run() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 65, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete self.run_forever() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever self._run_once() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once handle._run() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher await _run_matcher(

File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run await handler( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\dependencies__init.py", line 94, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_plugin_deerpipe__init__.py", line 42, in deer: dict[int, int] = await attend(now, user_info.user_id) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_plugin_deer_pipe\database.py", line 60, in attend await session.exec(select(UserDeer).where(UserDeer.user_id == user_id)) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlmodel\ext\asyncio\session.py", line 81, in exec result = await greenlet_spawn( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 203, in greenlet_spawn result = context.switch(value) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlmodel\orm\session.py", line 66, in exec results = super().execute( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\session.py", line 2362, in execute return self._execute_internal( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\session.py", line 2226, in _execute_internal ) = compile_state_cls.orm_pre_session_exec( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\context.py", line 549, in orm_pre_session_exec session._autoflush() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\session.py", line 3061, in _autoflush raise e.with_traceback(sys.exc_info()[2]) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\session.py", line 3050, in _autoflush self.flush() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\session.py", line 4352, in flush self._flush(objects) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\session.py", line 4487, in _flush with util.safe_reraise(): File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in exit__ raise exc_value.with_traceback(exc_tb) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\session.py", line 4448, in _flush flush_context.execute() File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 466, in execute rec.execute(self) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 642, in execute util.preloaded.orm_persistence.save_obj( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\persistence.py", line 93, in save_obj _emit_insert_statements( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\orm\persistence.py", line 1233, in _emit_insert_statements result = connection.execute( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 1418, in execute return meth( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\sql\elements.py", line 515, in _execute_on_connection return connection._execute_clauseelement( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 1640, in _execute_clauseelement ret = self._execute_context( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 1846, in _execute_context return self._exec_single_context( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 2355, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\default.py", line 941, in do_execute cursor.execute(statement, parameters) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 147, in execute self._adapt_connection._handle_exception(error) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 298, in _handleexception raise error File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 129, in execute self.await(_cursor.execute(operation, parameters)) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util_concurrency_py3k.py", line 196, in greenlet_spawn value = await result File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 48, in execute await self._execute(self._cursor.execute, sql, parameters) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\cursor.py", line 40, in _execute return await self._conn._execute(fn, *args, **kwargs) File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 132, in _execute return await future File "C:\Users\18280\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 115, in run result = function() sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (sqlite3.IntegrityError) NOT NULL constraint failed: user.id [SQL: INSERT INTO user (year, month) VALUES (?, ?)] [parameters: (2024, 9)] (Background on this error at: https://sqlalche.me/e/20/gkpj)

enKl03B commented 1 month ago

+1,在Ubuntu 22.04遭遇相同报错
py3.10

SamuNatsu commented 1 month ago

bug已定位,今天中午左右修(

大晚上不睡觉🦌什么管

Momoi-coder commented 1 month ago

好的,谢谢大佬,辛苦了

SNRainiar @.***> 于 2024年9月1日周日 01:18写道:

bug已定位,今天中午左右修(

— Reply to this email directly, view it on GitHub https://github.com/SamuNatsu/nonebot-plugin-deer-pipe/issues/8#issuecomment-2322976638, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJCNDQFHF7NNSBTCW76KM3LZUH3HFAVCNFSM6AAAAABNOAI4H2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRSHE3TMNRTHA . You are receiving this because you authored the thread.Message ID: @.***>

enKl03B commented 1 month ago

好的,谢谢大佬

SamuNatsu commented 1 month ago

已于 v0.3.3 修复