{u'error_code': 71, u'result': u'FAIL', u'error': u'RPC_CALL_FAIL 400: INPUT_FETCH_ERROR'} on set_profile_photo
The problem
set_profile_photo returns {u'error_code': 71, u'result': u'FAIL', u'error': u'RPC_CALL_FAIL 400: INPUT_FETCH_ERROR'} after uploads image
Your environment
python 2.7.6, last pytg and Elementary OS (Ubuntu).
Steps to reproduce
sender = Sender(host, port) sender.set_profile_photo(path) The path is correct, if the path is incorrect returns other error.
Expected behaviour
return True and update the profile picture
Actual behaviour
return {u'error_code': 71, u'result': u'FAIL', u'error': u'RPC_CALL_FAIL 400: INPUT_FETCH_ERROR'}
Looks like the problem actually lies in Telegram CLI. I get exactly the same error there.
Please check the command in the cli (--json flag).
If you need help, post the log output please. How to enable Debug
In the cli returns the same error.
The complete log is:
DEBUG:pytg.sender:Parsing set_profile_photo: Argument /home/sento/a.jpg - <file> (needed)
DEBUG:pytg.sender:Sending command >[disable_preview] set_profile_photo '/home/sento/a.jpg'
<
DEBUG:pytg.sender:Socket Connected.
DEBUG:pytg.sender:All Sent.
{u'error_code': 71, u'result': u'FAIL', u'error': u'RPC_CALL_FAIL 400: INPUT_FETCH_ERROR'}
So the command [disable_preview] set_profile_photo '/home/sento/a.jpg' fails?
Does set_profile_photo '/home/sento/a.jpg'fail too?
Yes
The problem can be fixed in Telegram CLI, concretly in: https://github.com/vysheng/tgl
In order to fix the problem, remove the duplicated line: out_int (CODE_photos_upload_profile_photo);
At tgl/queries.c, method static void send_avatar_end, case TGL_PEER_USER, line 1865. Or just check pullrequest: vysheng/tgl#105
Then just re-make Telegram-CLI.
Thank you very much @s-londono this solves the problem
Maybe I should maintain a fork with all the needed pull requests, as @vysheng seem to have not enough time anymore to work on it or even merge existing pull requests...
I have same issue, When I want forward a media I see this error, My code is :
# coding=utf-8
from __future__ import unicode_literals
from pytg import Telegram
tg = Telegram(
telegram="/home/saeb/Downloads/git/tg/telegram-cli/bin/telegram-cli",
pubkey_file="/home/saeb/Downloads/git/tg/telegram-cli/tg-server.pub",
port=8032
)
inline_image = False
receiver = tg.receiver
sender = tg.sender
from pytg.receiver import Receiver # get messages
from pytg.sender import Sender # send messages, and other querys.
from pytg.utils import coroutine
import logging
logging.basicConfig(level=logging.DEBUG)
#315156394
__author__ = 'saeb'
ADMIN_IDS =['$0100000084cba20ed401c9a0893540b9'] # you should probably change this.
def main():
receiver.start()
receiver.message(schedulerDeleter(sender))
receiver.stop()
print("I am done")
@coroutine
def schedulerDeleter(sender):
quit = False
try:
while not quit:
msg = (yield)
print(msg)
sender.status_online()
if msg.event == "message" and not msg.own:
msgTime = msg.sender.when.split()
msgID = msg.id
msgSenderId = msg.sender.id
print("\n msg time= {}\n msgID = {}\
msgSenderId = {}".format(msgTime, msgID,\
msgSenderId))
#print("\n msg txt = {} \n".format(msg.text))
if 'text' not in msg:
msgFromId = msg.fwd_from.id
sender.fwd_media(msgFromId,msgID)
else:
sender.fwd(msgSenderId,msgID)
#print(msg)
if msg.event != "message":
continue
if msg.own:
continue
else:
sender.send_msg(msg.peer.cmd, "سلام!")
except GeneratorExit:
pass
except KeyboardInterrupt:
pass
else:
pass
if __name__ == '__main__':
main()
and when I forward a media to it I see this error: https://pastebin.com/f89xhznd (original) https://pastebin.com/u12xrk3q (python syntax highting)