python-wechaty icon indicating copy to clipboard operation
python-wechaty copied to clipboard

message.to_file_box方法错误

Open libaiya opened this issue 4 years ago • 3 comments

我试着用wechaty重的message.to_file_box方法解析文件,视频文件能够正常转换成file_box类型并且下载通过file_box.to_file()方法保存。但是图片保存时却遇到错误: internal error <(<Status.UNKNOWN: 2>, 'Can not get file for message: 6213715697042163424', None) 我的代码时这样的:

if msg.type()==MessageType.MESSAGE_TYPE_IMAGE:
            await conversation.ready()
            my_file_box=await msg.to_file_box()
            await my_file_box.to_file("/root/wechaty/file_box/pic.data",True)
elif msg.type()==MessageType.MESSAGE_TYPE_VIDEO:
            await conversation.ready()
            my_file_box=await msg.to_file_box()
            await my_file_box.to_file("/root/wechaty/file_box/viddeo.data",True)

另外,对于message.to_file_box()方法,理论上是不是可以支持更多的类型,比如语音(MESSAGE_TYPE_AUDIO)。因为 Puppet接口是支持Yes: 图片/音频/视频 文件的。是现在还没实现还是有其他的方式解析音频。非常感谢

libaiya avatar Mar 27 '21 08:03 libaiya

First, please use markdown gramma to format your rendered content, so that we can get a more readable issue. Thanks a lot.

Second, we can use to_file_box() to get the out-of-box data object for the target file which can be saved as the local file. I can not get the detailed info about your issue. Please give me more clear info about your problem. eg: package version list, the type of your token, your error stack message and more info which you think is important.

wj-Mcat avatar Mar 27 '21 09:03 wj-Mcat

我是用的token类型是PuppetPadchat; 我使用的packpackage version如下:

chatie-grpc            0.18.12
wechaty                0.7.dev16
wechaty-grpc           0.20.19
wechaty-plugin-contrib 0.0.5
wechaty-puppet         0.3.dev2
wechaty-puppet-hostie  0.2.1
wechaty-puppet-service 0.7.dev8

我是用的python版本是Python 3.9.0 ; 报错信息只有上面我发的信息:

2021-03-27 17:40:18,528 - Message - INFO - Message to FileBox
2021-03-27 17:40:18,532 - Wechaty - ERROR - internal error <(<Status.UNKNOWN: 2>, 'Can not get file for message: 1049838345571025951', None)>

libaiya avatar Mar 27 '21 09:03 libaiya

Under my test for different token service, it's a truly bug that in padlocal token to fetch image file box. We will try to solve it later.

wj-Mcat avatar May 12 '21 07:05 wj-Mcat