Python SCript - 'NoneType' object has no attribute 'vertices' I have several pieces of geometry, seemingly imported from some parametric modelling tool. They all have an ".ipt" in their object name.
My original goal was to write a script that goes through all the objects in the scene, gets the object's dimensions, counts the number of vertices in a an object, compares it to the same parameters in the active object, and replaces object data if it finds a match. To that end I wrote the following:

from bpy import context

scene = bpy.context.scene

actob = bpy.context.selected_objects[0]
actobdat = bpy.context.selected_objects[0].data
ob = bpy.context.object
dimact = actob.dimensions
conapp = 0.007
actobvert = len(actobdat.vertices)

for ob in scene.objects:

    dimob = ob.dimensions
    obvert = len(ob.data.vertices)

    if abs(dimact[1] - dimob[1]) &lt; conapp and abs(dimact[2] - dimob[2]) &lt; conapp and abs(dimact[0] - dimob[0]) &lt; conapp and actobvert == obvert:

        ob.select = True
        ob.data = actobdat


In response to this I received the following error message:
AttributeError: 'NoneType' object has no attribute 'vertices'

I did some searching online, but still failed to solve the issue.
Any help would be greatly appreciated! Thank you!
It says 'NoneType' object has no attribute 'vertices', so it can be an empty that is being selected. You must check that the objects are meshes:

actob = bpy.context.active_object
if actob.type == 'MESH':
    actobdat = actob.data
    dimact = actob.dimensions
    [...]
    for ob in scene.objects:
        if ob.type == 'MESH':
            dimob = ob.dimensions
            etc...


You use bpy.context.active_object to get the active object, the index 0 of selected_objects will give you the last object added to the scene within the selection.