Python: TypeError: 'str' object is not callable Rating System -


when run code:

def printpredictions(matches):     ppredictiontable = prettytable()     ppredictiontable.field_names = ["player 1", "player 2", "difference", "winner"]     match in matches:         p1 = match['teama']         p2 = match['teamb']         if match['abeatb'] == true:             ppredictiontable.add_row([match['teama'], match['teamb'], match['difference'], p1])                      else:             ppredictiontable.add_row([match['teama'], match['teamb'], match['difference'], p2])      print(ppredictiontable)      printpredictions(pmatches) 

i error:

traceback (most recent call last):   file "c:\users\ericr_000\desktop\pydev\npa-2-rating-system\rankings.py", line 645, in <module>     printpredictions() typeerror: 'str' object not callable 

i have pmatches separate dictionary, , don't have coding skills fix issue. (line 145 printpredictions(pmatches)

if you're getting 'str' object not callable when try call printpredictions, means time program reaches line 645, name printpredictions reassigned string. somewhere in code have like

printpredictions = somestringvaluegoeshere 

you should choose different name variable, or delete line entirely.

foobar = somestringvaluegoeshere 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -