value error:math domain error

greetz members

the code below works fine in runtime but return a "value error:math domain error " on line13 in console. not really
good in python so cant figured out where to fix … pls help?

from math import degrees,acos
cont = GameLogic.getCurrentController()
own = cont.getOwner()

scn = GameLogic.getCurrentScene()
obj = scn.getObjectList()
sp = obj['OBSphere']
act = cont.actuators["act"]     

vect = own.getVectTo(sp)


b = degrees(acos(vect[2][1]))      this is line 13
    
if b < 30 :

 act.object = sp
 cont.activate(act)
    


Basic math fun time,
what is the domain of the arc cosine function?
[-1,1]
What is the domain of vector components? Probably [-inf,inf]
Your vector is not of unit length.

Not really a python question, but you can use unitVect = vect.normalized().

http://www.blender.org/api/blender_python_api_2_73_release/mathutils.html?highlight=normalized#mathutils.Vector.normalized