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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -