Error when processing a blender file in Python
There's a chance you deleted the lamp but it's still lingering somewhere in your blendfile and the script is accessing it. To be sure this is not the case, try saving, closing, and opening the blendfile multiple times to completely get rid of unused data and try your script again. Or you can try copying the mesh files to a brand new blender scene without any object and run the script there