Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My arcpy script builds a Python dictionary, dictCLPnts, that holds the geometry objects of a polyline feature class. The following code snippet shows the attempt to access the geometry object with the key "rwy":

feat = dictCLPnts[rwy]
arcpy.AddMessage('feat is type  %s' % (type(feat)))
arcpy.AddMessage('partcount = %s' % (str(feat.partCount)))
arcpy.AddMessage('pointcount = %s' % (str(feat.pointCount)))
part0 = feat.getPart(0)
arcpy.AddMessage('part0 is type  %s' % (type(part0)))
pnt1 =
if not pnt1:  #in case there is a Null pnt at the beginning of the part
    pnt1 =
arcpy.AddMessage('pnt1 is type  %s' % (type(pnt1)))
X1 = pnt1.X
Y1 = pnt1.Y

Here is the output:

feat is type  <class 'arcpy.arcobjects.geometries.Polyline'>
partcount = 1
pointcount = 1002
part0 is type  <class 'arcpy.arcobjects.arcobjects.Array'>
pnt1 is type  <type 'NoneType'>
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'X'

Looks to me like the points are there (and there isn't any reason for them not to be). I checked the original data, and the points are all there, z-values and all. It draws fine, and Check Geometry reports nothing amiss. I am just baffled by this. Yes, I could refactor and use a cursor (yet again), but that would be hideous at this point in the code. Dictionaries are also a lot faster. If anyone has any insight on this one, please let me know. Thank you, all.

share|improve this question
There will never be a null part at the beginning of a valid shape, within if it is a multipart shape, but not at the beginning. – Dan Patterson Sep 15 '11 at 20:24
@Dan - Thank you for this confirmation... which is why I think it is a bug. My data check out, and the problem is repeatable in a separate script with unrelated data. To make matters worse, I installed SP1 and SP2 (as I hadn't yet) to see if that would eliminate the problem: it did not. In fact, now arcpy cannot retrieve Z values, at least with the object.Z syntax. Now I am really screwed. – celticflute Sep 16 '11 at 13:16
UPDATE: ESRI Support is working on these problems. I still think the first problem, the failure to read geometry vertices, is a bug. The second almost surely is. Without changing my script at all I uninstalled the service packs, ran the script again, and, lo and behold, no more z-value problem. This is just nuts. These service packs have been out for a while. Hasn't anyone else run across these bugs? Am I the only one? I can't imagine. – celticflute Sep 19 '11 at 13:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.