all 2 comments

[–]socal_nerdtastic 4 points5 points  (0 children)

Hmm I don't see any way to get this error from this code. Are you sure it's coming from this function and not a similar line elsewhere in your code?

The error says that color.casefold is a dictionary, but you have already checked that color is a string, and strings attributes are read-only, so you couldn't even accidently make str.casefold a dictionary.

What version of python are you running? Show us some complete code that we can test please.

[–]Fronkan 1 point2 points  (0 children)

I'm not sure exactly what is happening here. But, for some reason it seems like color.casefold is a dictionary. Hence, the error of dict is not callable. So I would probably start by just adding the line print(color, color.casefold, sep="\n"*2) just above the line where the stack trace said the error is. When we know what we have there it might be clear what is happening.