Select shortest path with python
OK sweet I managed to figure this one out myself with a lot of perseverance (and grumbling) ... This is the final code I needed

def surf_len(ob, path):
    # first deselect all other objects and select our target object
    bpy.ops.object.mode_set(mode='OBJECT')
    bpy.ops.object.select_all(action='DESELECT')
    ob.select = True
    bpy.context.scene.objects.active = ob

    # next select all the vertices in out path
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.select_mode(type="VERT")
    bpy.ops.mesh.select_all(action='DESELECT')
    bpy.ops.object.mode_set(mode='OBJECT')
    for vi in vert_indices:
        ob.data.vertices[vi].select = True

    # select the shortest path
    bpy.ops.object.mode_set(mode='EDIT')
    r = bpy.ops.mesh.shortest_path_select()
    ob.select = False
    bpy.ops.object.mode_set(mode='OBJECT')
    if 'CANCELLED' in r:
        raise ValueError('Cannot build shortest path for {}: {}'.format(vert_indices, r))


I think the main thing I needed was the vertices objects I was passing in, that I had found earlier, had completely crazy indexes and just were not the same ones I found for some reason, this seemed to happen after I added a bunch of other objects to the scene

So instead I record the vertices index when I found it on the object originally and then use those for the select which seems to work .... I don't know why this happens, all I was doing was saving a list of ob.data.vertices[vert_index] to a list, when I came to use them later the vert_index were ok to be used in the function above, but the actual vertices seemed to be no good ... ie the code did something like this

    vert_list = []
    for face in ob.data.polygons:
        for vert_index, loop in zip(face.vertices, face.loop_indices):
            vert_list.append(ob.data.vertices[vert_index])


If anyone knows why this vert_list is no good after a bit of editing to the scene I would be very interested.

Anyway once I figure out that problem, the rest was just a matter of fiddling about to get the correct modes etc ... I think bpy.context.scene.objects.active = ob helped too

Cheers all.