wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.61k stars 232 forks source link

Send video #244

Open EnergeticChubby opened 3 years ago

EnergeticChubby commented 3 years ago

When I tried to send video, it cannot work.

Code

    if msg.text() == 'ding':
        file_box_3 = FileBox.from_file('51961638877671026199.mp4')
        print(file_box_3)
        await msg.say(file_box_3)

Error info

<wechaty_puppet.file_box.file_box.FileBox object at 0x7f3737263d50>
2021-08-05 10:04:06,614 - Message - INFO - say() <<wechaty_puppet.file_box.file_box.FileBox object at 0x7f3737263d50>>
Exception in callback AsyncIOEventEmitter._emit_run.<locals>._callback(<Task finishe...ertionError()>) at /home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/pyee/_asyncio.py:55
handle: <Handle AsyncIOEventEmitter._emit_run.<locals>._callback(<Task finishe...ertionError()>) at /home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/pyee/_asyncio.py:55>
Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/pyee/_asyncio.py", line 62, in _callback
    self.emit('error', exc)
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/wechaty/wechaty.py", line 284, in emit
    super().emit(event, *args, **kwargs)
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/pyee/_base.py", line 116, in emit
    self._emit_handle_potential_error(event, args[0] if args else None)
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/pyee/_base.py", line 86, in _emit_handle_potential_error
    raise error
  File "wechatyrun.py", line 243, in on_message
    await msg.say(file_box_3)
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/wechaty/user/message.py", line 175, in say
    await message.ready()
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/wechaty/user/message.py", line 465, in ready
    self.payload = await self.puppet.message_payload(self.message_id)
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/wechaty_puppet_service/puppet.py", line 428, in message_payload
    response = await self.puppet_stub.message_payload(id=message_id)
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/wechaty_grpc/wechaty/__init__.py", line 322, in message_payload
    "/wechaty.Puppet/MessagePayload", request, puppet.MessagePayloadResponse
  File "/home/ubuntu/miniconda3/envs/p2/lib/python3.7/site-packages/betterproto/__init__.py", line 1125, in _unary_unary
    assert response is not None
AssertionError
wj-Mcat commented 3 years ago

This bug is to be solved at next few days. Please keep eyes on this issue to get latest news.

wj-Mcat commented 3 years ago

I'm sorry to tell you that wechaty can't send big video file beacuase of some wechaty structure reasons, and there will be some changes in sending file implementation. please refer to : https://github.com/wechaty/python-wechaty-puppet-service/pull/64#issuecomment-911103851

Please keep eyes on this issue to get latest progress of this problem.