# 'coroutine' object is not iterable

**URL:** <https://forum.rasa.com/t/coroutine-object-is-not-iterable/15491>\
**Category:** Rasa Open Source\
**Created:** [September 10, 2019, 4:38pm UTC](https://forum.rasa.com/t/coroutine-object-is-not-iterable/15491 "2019-09-10T16:38:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hodinhdung1997](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@hodinhdung1997](https://forum.rasa.com/u/hodinhdung1997)\
**Post date:** [September 10, 2019, 4:38pm UTC](https://forum.rasa.com/t/coroutine-object-is-not-iterable/15491/1 "2019-09-10T16:38:12Z")

</div>

i have a problem with this TypeError: ‘coroutine’ object is not iterable Rasa version: 1.3.2 rasa-core:0.14.5 rasa-sdk:1.3.2 rasa-nlu:0.15.1 python version :3.6.6 this is my code train\_dialog.py

**def train\_dialog(dialog\_training\_data\_file,domain\_file,path\_to\_model=‘models/dialogue’):** \*\* logging.basicConfig(level =‘INFO’)\*\*

\*\* agent = Agent(domain\_file,policies =[MemoizationPolicy(),KerasPolicy()])\*\* \*\* training\_data= agent.load\_data(dialog\_training\_data\_file)\*\* \*\* agent.train(training\_data)\*\* \*\* agent.persist(path\_to\_model)\*\*

* * *

**train\_dialog(‘data/stories.md’,‘domain.yml’)** Help me. Thank you everyone.

---

<div class="post-metadata">

**Author:** ![piyush29programmer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/piyush29programmer/32/4050_2.png) [@piyush29programmer](https://forum.rasa.com/u/piyush29programmer)\
**Post date:** [September 10, 2019, 6:14pm UTC](https://forum.rasa.com/t/coroutine-object-is-not-iterable/15491/2 "2019-09-10T18:14:35Z")

</div>

Please try this below code it may will work.

async def train\_core(domain\_file: Text = “domain.yml”, model\_directory: Text = “models”, model\_name: Text = “core”, training\_data\_file: Text = “data/stories.md”,):

```auto
logging.basicConfig(filename=logfile, level=logging.DEBUG)

agent = Agent(
    domain_file,
    policies=[
        MemoizationPolicy(max_history=3),
        KerasPolicy(batch_size=100, epochs=400, validation_split=0.2)
    ]
)
training_data = await agent.load_data(training_data_file)
agent.train(training_data)

# Attention: agent.persist stores the model and all meta data into a folder.
# The folder itself is not zipped.
model_path = os.path.join(model_directory, model_name)
agent.persist(model_path)

```

if **name** == ‘ **main** ’: loop = asyncio.get\_event\_loop() loop.run\_until\_complete(train\_core())
