I am trying to determine whether my shapefile that I pass is in M-aware (has M value). I keep getting an error

Attribute Error: 'Polyline' object has no attribute 'hasM'

Not sure what I am doing wrong.

import arcpy

def ValidInputGeometry(feat):
    is_valid_poly_line = False
    is_m_enabled = False
    error_msg = None
    if feat.type == "polyline":
        if is_m_enabled == feat.hasM:
            is_valid_poly_line = True
            error_msg = "The input geometry is not M-Aware"
        error_message = "The input geometry is not a polyline"
    return (is_valid_poly_line, error_msg)

station_interval = 10000
in_polyline_m_layer = "C:/Users/Algorithm/LWOB_levee.shp"
target_feature_rows = arcpy.SearchCursor(in_polyline_m_layer, "FID = 0", "", "", "")
layer_description = arcpy.Describe(in_polyline_m_layer)
shape_field = layer_description.ShapeFieldName

for row in target_feature_rows:
    feat = row.getValue(shape_field)

    (Valid, Msg) = ValidInputGeometry(feat)    
  • 1
    Try arcpy.Describe(in_polyline_m_layer).hasM.
    – blah238
    Mar 8, 2013 at 19:57
  • 1
    Or with your own code, layer_description.hasM ... a geometry object does not have a hasM property, but it does have a construction parameter hasM -- which may be the confusion.
    – awesomo
    Mar 8, 2013 at 20:26

1 Answer 1


It appears that the geometry objects returned from cursors are not fully attributed (no hasM, hasZ, etc.) but you can find out whether the feature class itself supports M values using the feature class Describe object's hasM property:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.