Select to view content in your preferred language

Calculate Geometry Attributes causing AttributeError

1569
10
Jump to solution
01-10-2024 10:13 AM
Christian_Kennedy
Occasional Contributor

Hello!

I am currently trying to create a script to automate parcel updates. I built the original script in a Notebook that works perfectly fine in Pro but now that I am trying to recreate it as a stand-alone script, I am running into some hiccups. My current sticking point is trying to calculate geometry attributes. It is coming back with the error: AttributeError: 'module' object has no attribute 'CalculateGeometryAttributes'

I have tried a couple of things based on what I have found on the web pertaining to this error. First, I tried using arcpy.CalculateGeometryAttributes_management instead of arcpy.management.CalculateGeometryAttributes but no luck.

I then tried to create a variable for the parameters since there is so much text and that also did not work.  

I am able to run the geoprocessing tool in Pro once the layers have been created with the script, the tool just isn't working in the script. 

Any thoughts? 

Here is how I have it set up in the script:

arcpy.CalculateGeometryAttributes_management(out_data_py,
"ACRE AREA",
'',
"ACRES",
'PROJCS["NAD_1983_StatePlane_Kansas_North_FIPS_1501_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",1312333.333333333],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-98.0],PARAMETER["Standard_Parallel_1",38.71666666666667],PARAMETER["Standard_Parallel_2",39.78333333333333],PARAMETER["Latitude_Of_Origin",38.33333333333334],UNIT["Foot_US",0.3048006096012192]]',
"SAME_AS_INPUT")
print("Acreage Calculated")

I am fairly new to writing Python scripts for automation so I apologize if this isn't very clear or if I haven't included enough info. It's a fairly long script (for me) so I didn't want to share a bunch of superfluous text but if it's needed, I can add more for context. Thank you for looking!

 

0 Kudos
10 Replies
Christian_Kennedy
Occasional Contributor

I figured it out! I THOUGHT I was running the same Python environment as Pro but I was running the Python env for ArcMap! Ugggghhhhh...I had checked but was not thorough enough apparently. But it's fixed and it's working now. Good gravy, what a relief. 

0 Kudos