bpy.ops.mesh.fill() Warning: No edges selected
I believe it's because I hadn't marked the object as active. I added

scn = bpy.context.scene
scn.objects.active = bpy.data.objects[0]


before doing the fill, and that seemed to fix the error. Of course, the fill was completely ... not what I'd expected so I'm persevering with a manual one for now!