python-telegram-bot在Python 3.x上不起作用

时间:2016-06-29 07:42:11

标签: python-3.x telegram-bot python-telegram-bot

我正在尝试制作一个使用python-telegram-bot的程序,我需要使用Python 3。但是当我尝试使用Python 3启动它时,我得到了一些我不太了解的错误。当我使用内置示例时也会发生同样的情况。有人能解释一下这意味着什么吗?程序的精确输出如下。

2016-06-29 06:17:44,260 - telegram.ext.updater - ERROR - unhandled exception

Traceback (most recent call last):

  File "/usr/local/lib/python3.4/dist-packages/telegram/ext/updater.py", line 105, in _thread_wrapper

    target(*args, **kwargs)

  File "/usr/local/lib/python3.4/dist-packages/telegram/ext/updater.py", line 216, in _start_polling

    self._bootstrap(bootstrap_retries, clean=clean, webhook_url='')

  File "/usr/local/lib/python3.4/dist-packages/telegram/ext/updater.py", line 320, in _bootstrap

    self.bot.setWebhook(webhook_url=webhook_url, certificate=cert)

  File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 121, in decorator

    result = func(self, *args, **kwargs)

   File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 1263, in setWebhook

    result = request.post(url, data, timeout=kwargs.get('timeout'))

  File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 174, in post

    headers={'Content-Type': 'application/json'})

  File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 100, in _request_wrapper

    resp = _get_con_pool().request(*args, **kwargs)

  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 72, in request

    **urlopen_kw)

  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 135, in request_encode_body

    **urlopen_kw)

TypeError: urlopen() got multiple values for keyword argument 'body'

Exception in thread updater:

Traceback (most recent call last):

  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner

    self.run()

  File "/usr/lib/python3.4/threading.py", line 868, in run

     self._target(*self._args, **self._kwargs)

  File "/usr/local/lib/python3.4/dist-packages/telegram/ext/updater.py", line 105, in _thread_wrapper

    target(*args, **kwargs)

  File "/usr/local/lib/python3.4/dist-packages/telegram/ext/updater.py", line 216, in _start_polling

    self._bootstrap(bootstrap_retries, clean=clean, webhook_url='')

  File "/usr/local/lib/python3.4/dist-packages/telegram/ext/updater.py", line 320, in _bootstrap

    self.bot.setWebhook(webhook_url=webhook_url, certificate=cert)

  File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 121, in decorator

    result = func(self, *args, **kwargs)

  File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 1263, in setWebhook

    result = request.post(url, data, timeout=kwargs.get('timeout'))

  File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 174, in post

    headers={'Content-Type': 'application/json'})

  File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 100, in _request_wrapper

    resp = _get_con_pool().request(*args, **kwargs)

  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 72, in request

    **urlopen_kw)

  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 135, in request_encode_body

    **urlopen_kw)

TypeError: urlopen() got multiple values for keyword argument 'body'

2016-06-29 06:17:45,248 - telegram.ext.dispatcher - CRITICAL - stopping due to exception in another thread

1 个答案:

答案 0 :(得分:0)

要使其正常工作,请从程序包管理器安装urllib3>=1.10