# Getting error while training using below python code

**URL:** <https://forum.rasa.com/t/getting-error-while-training-using-below-python-code/12047>\
**Category:** Rasa Open Source\
**Created:** [June 25, 2019, 2:45pm UTC](https://forum.rasa.com/t/getting-error-while-training-using-below-python-code/12047 "2019-06-25T14:45:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![duvaragan](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@duvaragan](https://forum.rasa.com/u/duvaragan)\
**Post date:** [June 25, 2019, 2:45pm UTC](https://forum.rasa.com/t/getting-error-while-training-using-below-python-code/12047/1 "2019-06-25T14:45:49Z")

</div>

I am a beginner to this forum and i am trying to run my train\_init.py code to train my BOT. But i get the below error. can someone please help? i am not able to identify which function is giving a none response. I compared the agent.py and domain.py in github and looks like they are recent .

train\_init.p

from **future** import absolute\_import from **future** import division from **future** import unicode\_literals

import logging

from rasa\_core.agent import Agent from rasa\_core.policies.keras\_policy import KerasPolicy from rasa\_core.policies.memoization import MemoizationPolicy

if **name** == ’ **main**': logging.basicConfig(level=‘INFO’)

```auto
training_data_file = './data/stories.md'
model_path = './models/dialogue'

agent = Agent('weather_domain.yml', policies = [MemoizationPolicy(max_history=2), KerasPolicy(max_history=4)])
data = agent.load_data(training_data_file)
agent.train(data)

agent.persist(model_path)

```

Below is my Domain.yaml slots: location: type: text

intents:

- greet
- goodbye
- request

entities:

- location

templates: utter\_greet:

- ‘Hello! How can i help?’ utter\_goodbye:
- ‘See you soon.’
- ‘Bye.’ utter\_ask\_location:

- ‘In what location?’

actions:

- utter\_greet
- utter\_goodbye
- utter\_ask\_location
- actions\_weather

Error i receive:

## /Applications/anaconda3/lib/python3.7/site-packages/rasa\_core/ **init**.py:12: UserWarning: The ‘rasa\_core’ package has been renamed. You should change your imports to use ‘rasa.core’ instead.

UserWarning, WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter\_greet’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template. WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter\_goodbye’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template. WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter\_goodbye’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template. WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter\_ask\_location’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template.

AttributeError Traceback (most recent call last) in 15 model\_path = ‘./models/dialogue’ 16 —\> 17 agent = Agent(‘weather\_domain.yml’, policies = [MemoizationPolicy(max\_history=2), KerasPolicy(max\_history=4)]) 18 data = agent.load\_data(training\_data\_file) 19 agent.train(data)

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/agent.py in **init** (self, domain, policies, interpreter, generator, tracker\_store, action\_endpoint, fingerprint, model\_directory, model\_server, remote\_storage) 287 ): 288 # Initializing variables with the passed parameters. –\> 289 self.domain = self.\_create\_domain(domain) 290 if self.domain: 291 self.domain.add\_requested\_slot()

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/agent.py in \_create\_domain(domain) 806 807 if isinstance(domain, str): –\> 808 domain = Domain.load(domain) 809 domain.check\_missing\_templates() 810 return domain

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in load(cls, paths, skill\_imports) 76 domain = Domain.empty() 77 for path in paths: —\> 78 other = cls.from\_path(path, skill\_imports) 79 domain = domain.merge(other) 80

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from\_path(cls, path, skill\_imports) 90 91 if os.path.isfile(path): —\> 92 domain = cls.from\_file(path) 93 elif os.path.isdir(path): 94 domain = cls.from\_directory(path, skill\_imports)

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from\_file(cls, path) 103 [@classmethod](https://github.com/classmethod) 104 def from\_file(cls, path: Text) -\> “Domain”: –\> 105 return cls.from\_yaml(rasa.utils.io.read\_file(path)) 106 107 [@classmethod](https://github.com/classmethod)

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from\_yaml(cls, yaml) 113 114 data = rasa.utils.io.read\_yaml(yaml) –\> 115 return cls.from\_dict(data) 116 117 [@classmethod](https://github.com/classmethod)

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from\_dict(cls, data) 118 def from\_dict(cls, data: Dict) -\> “Domain”: 119 utter\_templates = cls.collect\_templates(data.get(“templates”, {})) –\> 120 slots = cls.collect\_slots(data.get(“slots”, {})) 121 additional\_arguments = data.get(“config”, {}) 122 intent\_properties = cls.collect\_intent\_properties(data.get(“intents”, {}))

/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in collect\_slots(slot\_dict) 207 slots = [] 208 for slot\_name in sorted(slot\_dict): –\> 209 slot\_class = Slot.resolve\_by\_type(slot\_dict[slot\_name].get(“type”)) 210 if “type” in slot\_dict[slot\_name]: 211 del slot\_dict[slot\_name][“type”]

AttributeError: ‘NoneType’ object has no attribute ‘get’

---

<div class="post-metadata">

**Author:** ![duvaragan](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@duvaragan](https://forum.rasa.com/u/duvaragan)\
**Post date:** [June 27, 2019, 2:48am UTC](https://forum.rasa.com/t/getting-error-while-training-using-below-python-code/12047/2 "2019-06-27T02:48:14Z")

</div>

can someone please help me with the above problem?
