Rotation and location axes can be locked from the logic panel > Advanced.
I’ve found that editing orientation matrices can get messy, since changing one of the vectors doesn’t necessarily change the others (many times it will deform the object). What’s technically wrong with the script is that the third item needs to be a vector like the other two are, or something like [0,0,1]. But I’d recommend going with one of the easier way to lock a rotation axis.
Yea just use a constraint actuator set on orientation with Z axis…its much easier than doing that…also I think that you should have used the alignAxisToVect(vect) method instead of the orientation thing.