TypeError: 'module' object is not iterable

Не понимаю, что консоли не нравится.

main.py

import json
import apiai
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
updater = Updater(token=token_for_bot) # token API  Telegram
dispatcher = updater.dispatche


# comends ob
def startCommand(bot, update):
    bot.send_message(chat_id=update.message.chat_id, text='Hi')

def textMessage(bot, update):
    request = apiai.ApiAI(token_for_dialogflow).text_request()                      # Dialogflow API Token
    request.lang = 'ru'                                                             # In what language will the request be sent
    request.session_id = 'BatlabAIBot'                                              # Dialog Session ID (you need to learn the bot later)
    request.query = update.message.text                                             # We send a request to the "AI" with a message from the user
    responseJson = json.loads(request.getresponse().read().decode('utf-8'))
    response = responseJson['result']['fulfillment']['speech']                      # Parse JSON and pull out the answer
                                                                                    # If there is an answer from the bot - send it to the user, if not - the bot did not understand it
    if response:
        bot.send_message(chat_id=update.message.chat_id, text=response)
    else:
        bot.send_message(chat_id=update.message.chat_id, text='I do not quite understand you!')

    #Handlers
start_command_handler = CommandHandler('start', startCommand)
text_message_handler = MessageHandler(Filters.text, textMessage)



# HAndlers on Disp
dispatcher.add_handler(start_command_handler)
dispatcher.add_handler(text_message_handler)


updater.start_polling(clean=True)
updater.idle()

Сообщение об ошибке:

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    updater = Updater(token=token_for_bot) # token API  Telegram
  File "/home/Maccree/.local/lib/python2.7/site-packages/telegram/ext/updater.py", line 164, in __init__
    defaults=defaults)
  File "/home/Maccree/.local/lib/python2.7/site-packages/telegram/bot.py", line 130, in __init__
    self.token = self._validate_token(token)
  File "/home/Maccree/.local/lib/python2.7/site-packages/telegram/bot.py", line 189, in _validate_token
    if any(x.isspace() for x in token):
TypeError: 'module' object is not iterable

Ответы (1 шт):

Автор решения: Makridenko A.

Код заработал при таком расскладе:

updater = Updater('YOR TOKEN HERE', use_context= True) # Токен API к Telegram
dispatcher = updater.dispatcher

Как и почему я не понял

→ Ссылка