CalculateGeometryAttributes missing 6th positional argument

302
3
03-05-2020 01:14 PM
CharlesHardy1
New Contributor II

When I attempt to run the CalculateGeometryAttributes in a Python window in ArcGIS Pro so I can add the last positional argument I get an error message stating:

TypeError: CalculateGeometryAttributes() takes from 0 to 5 positional arguments but 6 were given

According to the documentation at Calculate Geometry Attributes—Data Management toolbox | Documentation the syntax for this tool is: 

CalculateGeometryAttributes(in_features, geometry_property, {length_unit}, {area_unit},{coordinate_system}, {coordinate_format})


This shows 6 positional arguments but when I attempt to add a value for {coordinate_format} the tool won't accept it. Did ESRI change the syntax and remove this feature or is this a bug?

0 Kudos
3 Replies
JoshuaBixby
MVP Esteemed Contributor

What version of Pro are you running?  I just tested on Pro 2.5, and I don't have any issues.  If I pass 7 arguments, instead of 6, I can generate a similar TypeError:

TypeError: CalculateGeometryAttributes() takes from 0 to 6 positional arguments but 7 were given‍‍

What does the following show on your machine:

>>> CalculateGeometryAttributes.__code__.co_argcount
6
>>> 
CharlesHardy1
New Contributor II

Thank you for your help.  I think the issue may be I'm not on Pro 2.5 yet.  My organization is still running Pro 2.4.3.  I took a closer look and it appears that I'm still using version 2.4 of arcpy which uses CalculateGeometryAttributes_managment() with only 5 arguments.  CalculateGeometryAttributes() is not available in arcpy 2.4.  I assume that when I upgrade to Pro 2.5 my arcpy module will change to version 2.5 with the new capabilities.

arcpy.management.CalculateGeometryAttributes.__code__.co_argcount
5

I'm still on a learning how to use Python directly (either in Pro or in a Jupyter Notebook or Spyder).  It's a steep curve but I'm starting to figure it all out.


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

if you were doing it via code, and were using multiple properties, check your list of lists, you may be missing brackets

[["Left", "EXTENT_MIN_X"], ["Bottom", "EXTENT_MIN_Y"]]

0 Kudos