Mysteriously a tuple
When a result is inexplicably of the wrong type
Not the first time I've been stung by this, so it's worth recording the problem.
Symptoms
A function or call inexplicably returns not as the expected type but as a tuple containing the said type. After a furious amount of debugging, you determine that everything is acting as it should and returning the types that it should. Yet, somehow, the value you capture from a particular line is a tuple.
Your code will look something like this:
f = radio_input ('Pathogen', 'pathogen', pathogen_choices, env=d, ... ... helptext="Which organism are you looking for matches with?", default=None),
Diagnosis
You may have spotted this already but it's the trailing comma. Easy to miss when you're scanning complex code and a series of nested calls, but instead of this:
x = long_complicated_stuff
you're doing this:
x = long_complicated_stuff,
which evalulates to this:
x = (long_complicated_stuff, )
i.e. an implicit one-element tuple
Solution
Remove the comma, obviously.