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.56k stars 229 forks source link

🐛🐛 Bug Report: 语音消息to_file_box报错 #309

Closed 17186765070 closed 2 years ago

17186765070 commented 2 years ago

requirements

Describe your problem

将MESSAGE_TYPE_AUDIO 类型消息存到文件to_file_box() 报错

Reproduce your problem

if msg.type() == MessageType.MESSAGE_TYPE_AUDIO:
                    my_file_box = await msg.to_file_box()
                   await my_file_box.to_file(f"D:\Work_Projects\companyinfo\wechat", True)

Error info

2022-03-24 15:20:14,604 - Message - INFO - Message to FileBox
2022-03-24 15:20:14,744 - PuppetService - INFO - receive error info <{'code': 9999, 'msg': 'call already closed'}>
Traceback (most recent call last):
  File "D:/Work_Projects/companyinfo/ceshi/ceshi1.py", line 137, in <module>
    asyncio.run(main())
  File "C:\Python37-32\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Python37-32\lib\asyncio\base_events.py", line 587, in run_until_complete
    return future.result()
  File "D:/Work_Projects/companyinfo/ceshi/ceshi1.py", line 135, in main
    await bot.start()
  File "C:\Python37-32\lib\site-packages\wechaty\wechaty.py", line 394, in start
    await self.puppet.start()
  File "C:\Python37-32\lib\site-packages\wechaty_puppet_service\puppet.py", line 929, in start
    await self._listen_for_event()
  File "C:\Python37-32\lib\site-packages\wechaty_puppet_service\puppet.py", line 1029, in _listen_for_event
    payload = EventErrorPayload(**payload_data)
TypeError: __init__() got an unexpected keyword argument 'code'
[2022-03-24 15:20:14,745] ASGI Framework Lifespan error, shutdown without Lifespan support
Traceback (most recent call last):
  File "C:\Python37-32\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Python37-32\lib\asyncio\base_events.py", line 587, in run_until_complete
    return future.result()
  File "D:/Work_Projects/companyinfo/ceshi/ceshi1.py", line 135, in main
    await bot.start()
  File "C:\Python37-32\lib\site-packages\wechaty\wechaty.py", line 394, in start
    await self.puppet.start()
  File "C:\Python37-32\lib\site-packages\wechaty_puppet_service\puppet.py", line 929, in start
    await self._listen_for_event()
  File "C:\Python37-32\lib\site-packages\wechaty_puppet_service\puppet.py", line 1029, in _listen_for_event
    payload = EventErrorPayload(**payload_data)
TypeError: __init__() got an unexpected keyword argument 'code'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python37-32\lib\site-packages\hypercorn\asyncio\lifespan.py", line 32, in handle_lifespan
    await invoke_asgi(self.app, scope, self.asgi_receive, self.asgi_send)
  File "C:\Python37-32\lib\site-packages\hypercorn\utils.py", line 247, in invoke_asgi
    await app(scope, receive, send)
  File "C:\Python37-32\lib\site-packages\quart\app.py", line 1741, in __call__
    await self.asgi_app(scope, receive, send)
  File "C:\Python37-32\lib\site-packages\quart\app.py", line 1767, in asgi_app
    await asgi_handler(receive, send)
  File "C:\Python37-32\lib\site-packages\quart\asgi.py", line 308, in __call__
    event = await receive()
  File "C:\Python37-32\lib\site-packages\hypercorn\asyncio\lifespan.py", line 75, in asgi_receive
    return await self.app_queue.get()
  File "C:\Python37-32\lib\asyncio\queues.py", line 159, in get
    await getter
concurrent.futures._base.CancelledError

Your experiments

zpaimon commented 2 years ago

fixed