En Wed, 25 Feb 2009 13:31:25 -0200, Gary Wood <python...@sky.com> escribió:

Start looking at the error:

Traceback (most recent call last):
  File "E:/python/handson/backAndForth4.py", line 97, in <module>
    main()
  File "E:/python/handson/backAndForth4.py", line 90, in main
    moveAllOnLine(faceList, -dx, dy, stepsAcross/2, wait)
  File "E:/python/handson/backAndForth4.py", line 21, in moveAllOnLine
    for i in range(repetitions):
TypeError: 'float' object cannot be interpreted as an integer

It's rather understandable - you have a float object where Python is expecting an integer.
Where? The traceback says it all:

  File "E:/python/handson/backAndForth4.py", line 21, in moveAllOnLine
    for i in range(repetitions):

Ok, so repetitions should be an integer, but it isn't. Where does it come from? It's an argument to moveAllOnLine, and was called from main (see the line above that in the traceback). Now we look near that line:

    for i in range(2):
        moveAllOnLine(faceList, dx, 0, stepsAcross, wait)
        moveAllOnLine(faceList, -dx, dy, stepsAcross/2, wait)
        moveAllOnLine(faceList, -dx, -dy, stepsAcross//2, wait)

Don't you see something suspicious...?


--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to