question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue in Custom Action File

See original GitHub issue

Rasa version: rasa-core 0.13.7
rasa-core-sdk 0.12.2
rasa-nlu 0.14.6 Python version: Python 3.6.0 Operating system (windows, osx, …): Kali LInux 2019 Issue:

UnboundLocalError: local variable ‘response’ referenced before assignment I am getting this error while running my actions file, The first class is getting executed but not the other classes.

class AdmissionMcs(Action):
	response= " "
	def name(self):
		return 'admission_mcs'
	def run(self,dispatcher,tracker,domain):
		streams=tracker.get_slot('stream')
		if 'streams' == 'msc comp sci' or 'mcs':
			response=""" The admission for MCS is given on basis of 50% marks of bcs and 50% marks of entrance"""
		dispatcher.utter_message(response)
		return [SlotSet('stream',streams)]

class AdmissionBcs(Action):
	response=" "
	def name(self):
		return 'admission_bcs'
	def run(self,dispatcher,tracker,domain):
		streams=tracker.get_slot('stream')
		if 'streams' == 'bcs' or 'bsc comp sci':
			response=""" The admission for BCS is given on basis of entrance exam conducted by college"""
		dispatcher.utter_message(response)
		return [SlotSet('stream',streams)]

class AdmissionBba(Action):
	response= None
	def name(self):
		return 'admission_bba'
	def run(self,dispatcher,tracker,domain):
		streams=tracker.get_slot('stream')
		if 'streams' == 'bba':
			response=""" The admission for BBA is given through merit list on basis of 12th Marks """
		dispatcher.utter_message(response)
		return [SlotSet('stream',streams)]

class AdmissionMba(Action):
	response=" "
	def name(self):
		return 'admission_mba'
	def run(self,dispatcher,tracker,domain):
		streams=tracker.get_slot('stream')
		if 'streams' == 'mba':
			response=""" The admission for MBA is given through marks scored in CAT """
		dispatcher.utter_message(response)
		return [SlotSet('stream',streams)]

```
after i added response="  " the second class also started working, But not the further classes.
Its throwing me error in action server terminal
UnboundLocalError: local variable 'response' referenced before assignment

```

**Content of configuration file (config.yml)**:
```
{
"pipeline":"spacy_sklearn",
"path":"./models/nlu",
"data":"./data/data.json"
}
```

**Content of domain file (domain.yml)** (if used & relevant):
```yaml

```

```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
garchaaman19commented, Apr 12, 2019

Please give me URGENT REPLY,its not working. I need it urgently.

0reactions
akeladcommented, Apr 15, 2019

well, why would you not put an else statement? If the condition doesn’t match then the response variable doesn’t get assigned and therefore there will be no variable of that name, meaning your code will error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why a Custom Action May Not Run - Visual Studio Setup
Run depends.exe on your custom action server .dll file or .exe file on the machine where the custom action doesn't appear to run....
Read more >
How do I fix 'Setup project with custom action file not found ...
The answer is so maddeningly simple. If the last argument in the CustomActionData is going to contain spaces and thus you have to...
Read more >
Custom action to EXE file fails during installation
Re: Custom action to EXE file fails during installation ... Hi, The problem may be caused by the "\" character that is added...
Read more >
Issue with Custom Action calling Explorer in Windows
I made a batch file that calls c:\windows\explorer.exe with parameters. The script works fine, but even if the batch file only contains:.
Read more >
Problem with DLL Custom Action - Flexera Community
Physical presence of the dll file is needed for the CA(Custom Action) to work on the end-user machine. So we two situations: 1)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found