ImportError: cannot import name CalculateGeometryAttributes

207
4
Jump to solution
3 weeks ago
Carmack_Linde
New Contributor III

I am working on a script in PyCharm. When I run my set up lines: 

import arcpy, os
from arcpy import env
from arcpy.management import Delete, Rename, Copy, CreateFileGDB, CalculateGeometryAttributes

 I get the following error: 

ImportError: cannot import name CalculateGeometryAttributes

I need the CalculateGeometryAttributes tool in the last step of the script, and my code was working fine before I added it in. I was able to import and use Delete, Rename, Copy, and CreateFileGDB from the Management toolbox without issue.

I can't figure out what I'm doing wrong here and why this tool in particular is not able to import. Any help would be appreciated! 

0 Kudos
1 Solution

Accepted Solutions
Carmack_Linde
New Contributor III

Thank you both for your ideas, I still was unable to resolve and ended up deciding to just use an update cursor instead, which is working nicely. 

View solution in original post

0 Kudos
4 Replies
nzjs
by
New Contributor II

Can you use this function interface instead of trying to import it directly?

arcpy.CalculateGeometryAttributes_management()

 

DanPatterson
MVP Honored Contributor

Works for me... version of Pro?

from arcpy.management import CalculateGeometryAttributes
help(CalculateGeometryAttributes)

Help on function CalculateGeometryAttributes in module arcpy.management:

CalculateGeometryAttributes(in_features=None, geometry_property=None, length_unit=None, area_unit=None, coordinate_system=None, coordinate_format=None)
    CalculateGeometryAttributes_management(in_features, geometry_property;geometry_property..., {length_unit}, {area_unit}, {coordinate_system}, {coordinate_format})
 ... snip ...

 


... sort of retired...
DanPatterson
MVP Honored Contributor

Also check to see if you have this folder and it has files

C:\...Your_Install_folder...\Resources\ArcToolBox\toolboxes\Data Management Tools.tbx\CalculateGeometryAttributes.tool


... sort of retired...
Carmack_Linde
New Contributor III

Thank you both for your ideas, I still was unable to resolve and ended up deciding to just use an update cursor instead, which is working nicely. 

View solution in original post

0 Kudos