How to convert curve to armature
Can also do this straight from the curves bezier points.

Test script, select the curve in object mode.  Note for cyclic curves cannot create a circular parent structure for bones, eg the first bone can't have the last bone as a parent. AFAIK.

import bpy
context = bpy.context
scene = context.scene
curve_obj = context.object
curve = curve_obj.data

arm = bpy.data.armatures.new("BezArmature")
arm_obj = bpy.data.objects.new("BezArmature", arm)
scene.objects.link(arm_obj)

scene.objects.active = arm_obj
bpy.ops.object.mode_set(mode='EDIT')
mw = curve_obj.matrix_world
arm_obj.matrix_world = mw
for spline in curve.splines:
    points = [bp.co for bp in spline.bezier_points]
    if spline.use_cyclic_u:
        points.append(points[0])
    parent = None
    for i in range(len(points)-1):
        bone = arm.edit_bones.new("Bone")
        bone.head = points[i]
        bone.tail = points[i+1]
        bone.parent = parent
        bone.use_connect = True
        parent = bone
bpy.ops.object.mode_set(mode='OBJECT')