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

在调用 来两张图指令时报错 #236

Open
zwfengineer opened this issue Oct 14, 2024 · 5 comments
Open

在调用 来两张图指令时报错 #236

zwfengineer opened this issue Oct 14, 2024 · 5 comments

Comments

@zwfengineer
Copy link

10-14 19:38:26 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_pixivbot.handler.common.random_recommended_illust, lineno=35) failed.
Traceback (most recent call last):
File "", line 17, in
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot/init.py", line 335, in run
get_driver().run(*args, **kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot/drivers/none.py", line 56, in run
loop.run_until_complete(self._serve())
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/asyncio/base_events.py", line 634, in run_until_complete
self.run_forever()
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/asyncio/base_events.py", line 601, in run_forever
self._run_once()
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/asyncio/base_events.py", line 1905, in _run_once
handle._run()
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
await _run_matcher(

File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot/message.py", line 428, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
await handler(
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot/dependencies/init.py", line 94, in call
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/common/random_recommended_illust.py", line 39, in _
await RandomRecommendedIllustHandler(session, event).handle(count=count)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/base.py", line 111, in handle
await self.interceptor.intercept(self, self._parse_args_and_actual_handle, *args, **kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/combined_interceptor.py", line 54, in intercept
await self.x.intercept(
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/combined_interceptor.py", line 54, in intercept
await self.x.intercept(
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/combined_interceptor.py", line 54, in intercept
await self.x.intercept(
[Previous line repeated 2 more times]
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/service_interceptor.py", line 35, in intercept
await wrapped_func(*args, **kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/default_error_interceptor.py", line 43, in intercept
await wrapped_func(*args, **kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/timeout_interceptor.py", line 17, in intercept
await wait_for(wrapped_func(*args, **kwargs),
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
return fut.result()
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/loading_prompt_interceptor.py", line 24, in intercept
await wrapped_func(*args, **kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/retry_interceptor.py", line 28, in intercept
raise e
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/retry_interceptor.py", line 23, in intercept
return await wrapped_func(*args, **kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/interceptor/record_req_interceptor.py", line 16, in intercept
await wrapped_func(*args, **kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/base.py", line 124, in _parse_args_and_actual_handle
await self.actual_handle(**kwargs)
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/handler/common/random_recommended_illust.py", line 27, in actual_handle
illusts = await service.random_recommended_illust(count=count,
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/service/pixiv_service.py", line 111, in random_recommended_illust
illusts = [x async for x in repo.recommended_illusts()]
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/service/pixiv_service.py", line 111, in
illusts = [x async for x in repo.recommended_illusts()]
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/data/pixiv_repo/mediator_repo.py", line 389, in recommended_illusts
async for x in gen:
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/utils/shared_agen.py", line 62, in _generator
raise e
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/utils/shared_agen.py", line 55, in _generator
new_data = await self._origin.anext()
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/data/pixiv_repo/mediator.py", line 151, in mediate
async for x in self._load_many_from_remote_and_append(query_kwargs, max_item, max_page):
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/data/pixiv_repo/mediator.py", line 116, in _load_many_from_remote_and_append
async for item in self.remote_factory(query_kwargs):
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/data/pixiv_repo/remote_repo.py", line 249, in _get_illusts
async for page, metadata in self._load_many_pages(papi_search_func, "illusts",
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/data/pixiv_repo/remote_repo.py", line 214, in _load_many_pages
page, metadata = await self._load_page(papi_search_func, element_list_name, mapper=mapper,
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/nonebot_plugin_pixivbot/data/pixiv_repo/remote_repo.py", line 190, in _load_page
metadata = PixivRepoMetadata(next_qs=AppPixivAPI.parse_qs(next_url=raw_result["next_url"]))
File "/home/linyuan/miniconda3/envs/nonebot/lib/python3.9/site-packages/pydantic/main.py", line 212, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for PixivRepoMetadata
pages
Field required [type=missing, input_value={'next_qs': {'content_typ...7621790', '123262281']}}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing

@ssttkkl
Copy link
Collaborator

ssttkkl commented Oct 16, 2024

pip list一下

@zwfengineer
Copy link
Author

pip list一下
已经修了,我push一下。

@zwfengineer
Copy link
Author

pip list一下

aiofiles 24.1.0
aiohappyeyeballs 2.4.0
aiohttp 3.10.5
aiohttp_socks 0.9.0
aiosignal 1.3.1
aiosqlite 0.20.0
alembic 1.13.2
annotated-types 0.7.0
anyio 4.4.0
APScheduler 3.10.4
arclet-alconna 1.8.29
arrow 1.3.0
asgiref 3.8.1
async-asgi-testclient 1.4.11
async-timeout 4.0.3
asyncache 0.3.1
attrs 24.2.0
autopep8 2.2.0
binaryornot 0.4.4
cachetools 5.5.0
cashews 7.3.1
certifi 2024.8.30
chardet 5.2.0
charset-normalizer 3.3.2
click 8.1.7
cookiecutter 2.6.0
coverage 7.6.1
Deprecated 1.2.14
distlib 0.3.8
exceptiongroup 1.2.2
fastapi 0.114.2
filelock 3.16.0
filetype 1.2.0
flake8 6.1.0
frozendict 2.4.4
frozenlist 1.4.1
greenlet 3.1.0
h11 0.14.0
h2 4.1.0
hpack 4.0.0
httpcore 1.0.5
httptools 0.6.1
httpx 0.27.2
hyperframe 6.0.1
idna 3.10
importlib_metadata 7.2.1
importlib_resources 6.4.5
iniconfig 2.0.0
Jinja2 3.1.4
lazy 1.6
loguru 0.7.2
Mako 1.3.5
markdown-it-py 3.0.0
MarkupSafe 2.1.5
mccabe 0.7.0
mdurl 0.1.2
msgpack 1.1.0
multidict 6.1.0
nb-cli 1.4.2
nepattern 0.7.6
nonebot-adapter-onebot 2.4.5
nonebot-plugin-access-control 1.2.1
nonebot-plugin-access-control-api 1.2.0
nonebot-plugin-apscheduler 0.5.0
nonebot-plugin-localstore 0.7.1
nonebot-plugin-orm 0.7.6
nonebot-plugin-pixivbot 2.1.5.post1 /home/linyuan/nonebot-plugin-pixivbot
nonebot-plugin-send-anything-anywhere 0.6.1
nonebot_plugin_session 0.3.2
nonebot_plugin_session_orm 0.2.0
nonebot_plugin_session_saa 0.2.0
nonebot2 2.3.3
nonebug 0.3.7
noneprompt 0.1.9
numpy 2.0.2
packaging 24.1
pillow 10.4.0
pip 24.2
PixivPy-Async 1.2.14
platformdirs 4.3.3
pluggy 1.5.0
prompt_toolkit 3.0.47
pycodestyle 2.11.1
pydantic 2.9.1
pydantic_core 2.23.3
pydantic-settings 2.5.2
pyfiglet 1.0.2
pyflakes 3.1.0
Pygments 2.18.0
pygtrie 2.5.0
pytest 7.4.4
pytest-asyncio 0.21.2
pytest-cov 4.1.0
python-dateutil 2.9.0.post0
python-dotenv 1.0.1
python-slugify 8.0.4
python-socks 2.5.1
pytimeparser 0.2.0
pytz 2024.2
PyYAML 6.0.2
requests 2.32.3
rich 13.8.1
setuptools 74.1.2
shortuuid 1.0.13
six 1.16.0
sniffio 1.3.1
SQLAlchemy 2.0.34
ssttkkl-nonebot-utils 0.1.22
starlette 0.38.5
StrEnum 0.4.15
tarina 0.5.8
text-unidecode 1.3
tomli 2.0.1
tomlkit 0.13.2
types-python-dateutil 2.9.0.20240906
typing_extensions 4.12.2
tzlocal 5.2
urllib3 2.2.3
uvicorn 0.30.6
uvloop 0.20.0
virtualenv 20.26.4
watchfiles 0.24.0
wcwidth 0.2.13
websockets 13.0.1
wrapt 1.16.0
yarl 1.11.1
zipp 3.20.2

@zwfengineer
Copy link
Author

pip list一下

PixivRepoMetadata 这个类的调用中 optional 的属性也必须传入一个None才能运行
可能和pydantic更新有关系

@ssttkkl
Copy link
Collaborator

ssttkkl commented Oct 17, 2024

确实,我还没测过pydantic v2的表现(

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