I am not sure what is going on, the code you have shown doesn't look like it would give the error shown.
The error states that you are calling a str object, but I cant see that you are.
Edit: The codes runs for me with no errors
The following code is an example of what would trigger the error you are having.
The error states that you are calling a str object, but I cant see that you are.
Edit: The codes runs for me with no errors
The following code is an example of what would trigger the error you are having.
"Example of code that would cause the error"()