send message to bot
it crash
cat bot.py
from telegram.ext import Updater, CommandHandler
def start(bot, update):
update.message.reply_text('Hello World!')
def hello(bot, update):
update.message.reply_text(
'Hello {}'.format(update.message.from_user.first_name))
updater = Updater('MY_TOKEN')
updater.dispatcher.add_handler(CommandHandler('start', start))
updater.dispatcher.add_handler(CommandHandler('hello', hello))
updater.start_polling()
updater.idle()
Debian 8.6
Version of Python, python-telegram-bot & dependencies:
```python-telegram-bot 5.2.0
urllib3 1.9.1
certifi 2016.09.26
future 0.16.0
Python 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]
### Logs
python bot.py
Exception in thread updater:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(self.__args, *self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/telegram/ext/updater.py", line 115, in _thread_wrapper
target(args, *kwargs)
File "/usr/local/lib/python2.7/dist-packages/telegram/ext/updater.py", line 228, in _start_polling
self._bootstrap(bootstrap_retries, clean=clean, webhook_url='')
File "/usr/local/lib/python2.7/dist-packages/telegram/ext/updater.py", line 335, in _bootstrap
self.bot.setWebhook(webhook_url=webhook_url, certificate=cert)
File "/usr/local/lib/python2.7/dist-packages/telegram/bot.py", line 124, in decorator
result = func(self, args, *kwargs)
File "/usr/local/lib/python2.7/dist-packages/telegram/bot.py", line 1272, in setWebhook
result = self._request.post(url, data, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/telegram/utils/request.py", line 205, in post
*urlopen_kwargs)
File "/usr/local/lib/python2.7/dist-packages/telegram/utils/request.py", line 132, in _request_wrapper
resp = self._con_pool.request(args, *kwargs)
File "/usr/lib/python2.7/dist-packages/urllib3/request.py", line 72, in request
*urlopen_kw)
File "/usr/lib/python2.7/dist-packages/urllib3/request.py", line 135, in request_encode_body
**urlopen_kw)
TypeError: urlopen() got multiple values for keyword argument 'body'
```
@rchovan Try installing python-telegram-bot in a virtualenv. This error is usually caused by an old version of urllib3 that is installed by your systems package manager and cannot be replaced with a newer version by pip.
@jh0ker which version of urllib3 do I need ? Currently I have this:
```aptitude show python-urllib3
aptitude show python-urllib3
Package: python-urllib3
New: yes
State: installed
Automatically installed: yes
Version: 1.9.1-3
Priority: optional
Section: python
Maintainer: Debian Python Modules Team python-modules-team@lists.alioth.debian.org
Architecture: all
Uncompressed Size: 245 k
Depends: python:any (< 2.8), python:any (>= 2.7.5-5~), python-six
Recommends: ca-certificates, python-ndg-httpsclient, python-openssl, python-pyasn1
Description: HTTP library with thread-safe connection pooling for Python
urllib3 supports features left out of urllib and urllib2 libraries.
@rchovan urllib3 must be at least 1.10
upgraded to 1.16-1~bpo8+1 with aptitude -V install python-urllib3/jessie-backports
Most helpful comment
upgraded to 1.16-1~bpo8+1 with
aptitude -V install python-urllib3/jessie-backports