[Tutor] function error

Alan Gauld alan.gauld at btinternet.com
Wed Sep 29 23:13:42 CEST 2010


"roberto" <roberto03 at gmail.com> wrote

>> Perhaps if you provide the full traceback from the error

> here it is:
>
> TypeError                                 Traceback (most recent 
> call last)
>
> ~/randomMove2.py in <module>()
> ----> 1
>      2
>      3
>      4
>      5
...
> ~/checkForward.py in out_of_bounds()
>     19
>     20 def outOfBounds():
> ---> 21         if (abs(turtle.position()[0]) >
> turtle.window_height()/2) or (abs(turtle.position()[1]) >
> turtle.window_width()/2):
>     22                 return "true"
>     23         else:
>
> TypeError: 'function' object is unsubscriptable

OK, Thats a non standard error trace so presumably you are running it 
inside
an IDE of some kind? It may be the IDE is masking the true error.
What happens if you just execute the code from a shell prompt in a 
console
window?  Can you send the error trace from that?

HTH

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list