Plugin config list syntax

I am updating a plugin and I want to add a config option to it. This option needs to have multiple options on the same name. I would just list them in a single string as other plugins do, but some of the options have spaces in them. I tried setting it like
self.config.add({
‘relations’: [‘edit’, ‘first track release’, ‘remaster’],
})
When I do this, I get the error: “configuration error: recordingdate.relations must be a collection, not list”

How can I accomplish this?

Yo—this depends on how you’re accessing the configuration. What does your code look like when you’re doing something like config.get(...) or config.as_*(...)?

I am trying to simply use
if variable not in self.config[‘relations’]:

Aha! You may want to check out the docs for Confuse:
https://confuse.readthedocs.io/

You need to retrieve the value from the configuration to use it. For your case, try self.config['relations'].as_str_seq(), which makes sure the value is a list of strings.

1 Like

That got rid of the error message. Now I just need to check if it is working like I think it does.

All good.
Another question. Can I simply enter a list in the config.yaml as [‘item’, ‘item’]?

EDIT: tried it and it worked
thanks for your help