[Tutor] UNSUBSCRIPTABLE?

WM. wferguson1 at socal.rr.com
Mon Mar 9 02:20:41 CET 2009


I am using Python 26 on a Windows XP

OK, here are the three lines mentioned following the error message.

Traceback (most recent call last):
   File "C:\Python26\TicTacToeD.py", line 165, in <module>
     main()
   File "C:\Python26\TicTacToeD.py", line 150, in main
     DisplayBoard(board)
   File "C:\Python26\TicTacToeD.py", line 68, in DisplayBoard
     print "\n\t", board[1], "|", board[2], "|", board[3]
TypeError: 'function' object is unsubscriptable


line 165 = main()

def main():
     DisplayInstruct()
     puter, human = Pieces()
     turn = X
     board = NewBoard
     DisplayBoard(board)

line 150 = DisplayBoard(board)

line 69
def DisplayBoard(board):
     """Display board on screen."""
     print "\n\t", board[1], "|", board[2], "|", board[3]
     print "\t", "______"
     print "\t", board[4], "|", board[5], "|", board[6]
     print "\t", "______"
     print "\t", board[7], "|", board[8], "|", board[9], "\n"



More information about the Tutor mailing list