While not in your code, another hard-to-spot error is when the %
character is missing in an attempt of string formatting:
"foo %s bar %s coffee"("blah","asdf")
but it should be:
"foo %s bar %s coffee"%("blah","asdf")
The missing %
would result in the same TypeError: 'str' object is not callable
.