Check out the first Dataiku 8 Deep Dive focusing on Productivity on October 29th Read More

Unable to return project config

Level 4
Unable to return project config

Hi all,

I am writing a plugin which requires some user input, I am assigning the value of the input to a variable in my python code, like so:

 

 

key = get_recipe_config()['key']

 

 

However, when I run my recipe I get the error:

Job failed: Error in Python process: At line 23: <class 'KeyError'>: key

Line 23 the line I have shared above.

Here is the code from my plugins .json file where I define the key:

 

 

"params": [
            {
         "type": "SELECT",
         "name": "key",
         "label": "Authentication key",
         "description": "Select the required service authentication key.",
         "selectChoices": [
           { "value": "design/abd38200717c.json", "label": "design_717c"},
           { "value": "design/b3d42a4b33e5.json", "label": "design_33e5"},
           { "value": "automation/abd38200717c.json", "label": "automation_717c"},
           { "value": "automation/b3d42a4b33e5.json", "label": "automation_33e5"}                 
         ]
    },

 

 

I have used this approach previously without any issues, and I believe my code is correct - what am I missing that is causing "key" not to be found?

Ben

0 Kudos
4 Replies
Level 5

Hi @ben_p .

I might be completely lost here, but shouldn't the code be in the recipe.json file instead of the plugin.json one?

Just a thought on what might be just a typo.

0 Kudos
Level 4
Author

You are quite right @Ignacio_Toledo - thankfully that was just a typo ๐Ÿ™‚

I eventually worked out what I was doing wrong here, I hadn't set a default value for the 'key' parameter - so it was in fact empty - duh!

Ben

Level 5

I thought about that too. On one hand I thought "most probably it was not pasted". On the other, if it was that obvious I thought @ben_p  would solve by himself after some sleep! I've fight against gigantic bugs for hours, than would be shown to be just small typos when waking up the next day...

0 Kudos
Level 4
Author

Haha glad to hear it is not just me that goes through this ๐Ÿ˜„