python 3描述符“ to_bytes”需要一个“ int”对象,但收到一个“列表”

时间:2018-06-26 09:21:18

标签: python python-3.x byte

我正在尝试使用pyrogram库进行请求,但是在数据字段中出现错误

  

TypeError:描述符“ to_bytes”需要一个“ int”对象,但收到一个“列表”

代码:

app.send(
    functions.messages.GetBotCallbackAnswer(
        peer=app.resolve_peer("Tgr_review_bot"),         
        msg_id=msgid, // Not important its working 
        data=b"seller_start_page" ## Thats breaks. I tried with b and without b.
    ),
    retries=0,
    timeout=10)

TraceBack

Traceback (most recent call last):
  File "C:\Users\maorb\OneDrive\Desktop\Maor\python\tele\reviews\reviewbot.py", line 50, in <module>
    timeout=10
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyrogram\client\client.py", line 869, in send
    r = self.session.send(data, retries, timeout)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyrogram\session\session.py", line 413, in send
    return self._send(data, timeout=timeout)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyrogram\session\session.py", line 379, in _send
    message = self.msg_factory(data)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyrogram\session\internals\msg_factory.py", line 37, in __call__
    len(body)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyrogram\api\core\object.py", line 47, in __len__
    return len(self.write())
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyrogram\api\functions\messages\get_bot_callback_answer.py", line 72, in write
    b.write(Int(self.msg_id))
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyrogram\api\core\primitives\int.py", line 32, in __new__
    return int.to_bytes(value, cls.SIZE, "little", signed=signed)
TypeError: descriptor 'to_bytes' requires a 'int' object but received a 'list'

0 个答案:

没有答案