Animated line/pipe generator

Problem with changing bezier_points[i].handle_right/left.xyz location

full script:
http://www.pasteall.org/53088/python

problem lines: 126,127
test blend (just copy/paste code & hit run)
whatever I do, there are points that end up at 0,0,0.

http://38.media.tumblr.com/7fbb9377e2319af24975c127516183af/tumblr_n9c9rltgxt1rdg48ao1_500.gif


https://38.media.tumblr.com/79cbaf98e34ddf71a2a980c7daf0f4ba/tumblr_n9c9rltgxt1rdg48ao2_r1_250.gif
fixed! just needed to iterate 0-2 instead of 0-1 on the bezier_points[i]

script located here: https://github.com/RH2/B3DScripts/blob/master/nearestNeighborConnection.py