0
这项工作:在python-电报机器人发送二进制与sendDocument
mybot.sendDocument(chat_id=chatid, document=open('bla.pdf', rb'))
但是,如果我做之前:
with open('bla.pdf', 'rb') as fp:
b = fp.read()
我不能这样做:
mybot.sendDocument(chat_id=chatid, document=b)
的错误是:
TypeError: Object of type 'bytes' is not JSON serializable
我使用Python 3.5.2赢或Linux
谢谢回答