Open frostming opened 1 year ago
Oh, I managed to get the traceback:
Traceback (most recent call last):
File "/mnt/c/Workspace/GitHub/chatroom-syncer/src/chatroom_syncer/room_syncer.py", line 38, in on_message
await contact.avatar()
File "/mnt/c/Workspace/GitHub/chatroom-syncer/.venv/lib/python3.10/site-packages/wechaty/user/contact_self.py", line 36, in avatar
file_box = await super().avatar(None)
File "/mnt/c/Workspace/GitHub/chatroom-syncer/.venv/lib/python3.10/site-packages/wechaty/user/contact.py", line 580, in avatar
avatar = await self.puppet.contact_avatar(
File "/mnt/c/Workspace/GitHub/chatroom-syncer/.venv/lib/python3.10/site-packages/wechaty_puppet_service/puppet.py", line 563, in contact_avatar
return FileBox.from_json(response.filebox)
File "/mnt/c/Workspace/GitHub/chatroom-syncer/.venv/lib/python3.10/site-packages/wechaty_puppet/file_box/file_box.py", line 363, in from_json
if 'boxType' not in json_obj:
TypeError: argument of type 'NoneType' is not iterable
It seems to be caused by API change and the response body is empty
Are you saying that this change of filebox --> file_box led to the filebox empty?
I am not familiar with gRPC, but it looks like the python-wechaty-puppet-service side is still speaking the gRPC in a version without the (filebox --> file_box) change:
# print(response)
<wechaty_grpc.wechaty.puppet.ContactAvatarResponse object at 0x7f6aca819040>
# print(dir(response))
['FromString', 'SerializeToString', '__abstractmethods__', '__annotations__', '__bytes__', '__class__', '__dataclass_fields__', '__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__post_init__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__', '_abc_impl', '_betterproto', '_betterproto_meta', '_cls_for', '_get_field_default', '_get_field_default_gen', '_group_map', '_postprocess_single', '_serialized_on_wire', '_type_hint', '_unknown_fields',
'filebox', 'from_dict', 'from_json', 'parse', 'to_dict', 'to_json']
❯ pip freeze | grep wechaty
wechaty==0.8.66
wechaty-grpc==0.20.19
wechaty-puppet==0.4.23
wechaty-puppet-service==0.8.10
It's strange that the grpc was not tagged in this version in github
Or we understood this contact avatar interface wrongly, it's designed to get only the avatar of the bot himself/herself? Or the UOS puppet doesn't support such call(contactAvatar)?
Are you saying that this change of filebox --> file_box led to the filebox empty?
I am not familiar with gRPC, but it looks like the python-wechaty-puppet-service side is still speaking the gRPC in a version without the (filebox --> file_box) change:
# print(response) <wechaty_grpc.wechaty.puppet.ContactAvatarResponse object at 0x7f6aca819040> # print(dir(response)) ['FromString', 'SerializeToString', '__abstractmethods__', '__annotations__', '__bytes__', '__class__', '__dataclass_fields__', '__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__post_init__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__', '_abc_impl', '_betterproto', '_betterproto_meta', '_cls_for', '_get_field_default', '_get_field_default_gen', '_group_map', '_postprocess_single', '_serialized_on_wire', '_type_hint', '_unknown_fields', 'filebox', 'from_dict', 'from_json', 'parse', 'to_dict', 'to_json']
❯ pip freeze | grep wechaty wechaty==0.8.66 wechaty-grpc==0.20.19 wechaty-puppet==0.4.23 wechaty-puppet-service==0.8.10
It's strange that the grpc was not tagged in this version in github
Good catch, so it is confirmed, the change is introduced in Oct, 2021, while the latest stable release of wechaty-grpc
is in Feb, 2021, I will bump the version to see whether it works
Environment
Description
Whenever I tried to get the contact avatar by
await contact.avatar()
, the terminal logs the following error:Yes, there are no other related error logs except this line, which makes me really confusing. There seems to be no other documented way to get the avatar of a contact.
Minimum reproducible code