Forums

Send photo using telegram-bot get error

Hi, when i send an photo to telegram by using telegram-bot and python 2.7 i get this error please one help me. this error:

 pi@raspberrypi:~ $ python t2.py

Traceback (most recent call last):   File "t2.py", line 16, in <module>     bot.sendPhoto(chat_id=chat_id, photo=open('./capture.jpg', 'rb'))   File "/usr/local/lib/python2.7/dist-packages/telegram/bot.py", line 125, in decorator     result = func(self, args, *kwargs)   File "/usr/local/lib/python2.7/dist-packages/telegram/bot.py", line 151, in decorator     result = self._request.post(url, data, timeout=kwargs.get('timeout'))   File "/usr/local/lib/python2.7/dist-packages/telegram/utils/request.py", line 199, in post     result = self._request_wrapper('POST', url, body=data.to_form(), headers=data.headers)   File "/usr/local/lib/python2.7/dist-packages/telegram/utils/request.py", line 150, in _request_wrapper     raise Unauthorized() telegram.error.Unauthorized: Unauthorized

Again, this is a problem you're getting on a Raspberry Pi instead of on PythonAnywhere, so I don't know the solution. But you should probably take a look at the parameters you're using when connecting to Telegram.