Failed to execute (AddGeometryAttributes) TypeError: object() takes no parameters

1118
9
06-26-2020 08:59 AM
EvanMyers1
Occasional Contributor

So I am having an issue where my code was working yesterday but today it isn't.  I've restarted my machine just in case but didn't help.

Here is my code:

Input = 'wMeterGPS'
arcpy.AddGeometryAttributes_management(Input, "POINT_X_Y_Z_M")‍‍‍

The Error:

Start Time: Fri Jun 26 11:57:32 2020
Running script AddGeometryAttributes...
WARNING 001097: POINT_X already exists -- overwriting.
WARNING 001097: POINT_Y already exists -- overwriting.
Failed script AddGeometryAttributes...

Traceback (most recent call last):
   File "c:\program files (x86)\arcgis\desktop10.7\ArcToolbox\Scripts\AddGeometryAttributes.py", line 292, in <module>
      AddGeometryAttributes(fc, geomProperties, lUnit, aUnit, cs)
   File "c:\program files (x86)\arcgis\desktop10.7\ArcToolbox\Scripts\AddGeometryAttributes.py", line 56, in AddGeometryAttributes
      with arcpy.da.UpdateCursor(fc,fields + ["SHAPE@"],"",cs) as ucur:
TypeError: object() takes no parameters

Failed to execute (AddGeometryAttributes).

The tool adds the "POINT_X" and "POINT_Y" fields but it doesn't calculate the field.  I have deleted the fields after it creates them to try the tool again (I know it overwrites but its worth a try) but that doesn't work.

Any help would be great!

Thanks.

0 Kudos
9 Replies
MehdiPira1
Esri Contributor

Hi Evan Myers‌,

Is your data spatially defined (or projected)?

Is it possible to share your script?

It looks like you're getting an error in this line too:

with arcpy.da.UpdateCursor(fc,fields + ["SHAPE@"],"",cs) as ucur:
EvanMyers1
Occasional Contributor

Hello Mehdi,

Thank you for taking a look at my issue.

My data:

Projected Coordinate System: NAD_1983_StatePlane_Florida_East_FIPS_0901_Feet
Projection: Transverse_Mercator
False_Easting: 656166.66666667
False_Northing: 0.00000000
Central_Meridian: -81.00000000
Scale_Factor: 0.99994118
Latitude_Of_Origin: 24.33333333
Linear Unit: Foot_US

Geographic Coordinate System: GCS_North_American_1983
Datum: D_North_American_1983
Prime Meridian: Greenwich
Angular Unit: Degree

Those two lines of code I posted in my original post is all that my script contains.  I wanted to use them at the beginning of a script I am working on but now I can't really begin because I cant test the rest of it without it.

The line of code you highlighted is part of the error message I am getting.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Evan, is it a point featureclass?

Does the tool work within ArcToolbox? (ie.  skip the script to test the principle)


... sort of retired...
0 Kudos
EvanMyers1
Occasional Contributor

Hello Dan,

Yes, it is a point feature class with about 5,600 features.  I should also mention that for this test I used a feature class with less points in it, otherwise it is identical to the original, just a different name.

Here is a picture of the results window after running it from the tool box.  I didn't check any of the optional boxes.

This time none of the fields were created.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Evan, just try the Centroid option.  It will give X and Y

Also... try another file

Try to rule out the gdb, file and tool option


... sort of retired...
EvanMyers1
Occasional Contributor

When I select a new Point feature class or a shape file (both features I haven't tested before and are saved in different locations) I don't get a Centroid option.  When testing with a line feature, I get the centroid option,  but the tool still fails and reports the same problem. Is there something I'm missing that this tool requires?

0 Kudos
RandyBurton
MVP Alum

I made several attempts to generate an error similar to yours, but the tool seemed to handle a variety of situations quite well.  For example, I tried the "POINT_X_Y_Z_M" option with polygon and line features, and the tool responded with appropriate error messages.  Since the error message is coming from inside the AddGeometryAttributes tool, I would suspect the issue is with your wHydrantValveGPS feature layer - perhaps bad geometry, or some other corruption.

Does the feature load properly in Desktop?  Have you tried the actual tool in Desktop? The tool's dialog box may provide some additional error messages as the tool validator script will be invoked as the parameters are checked.

0 Kudos
EvanMyers1
Occasional Contributor

Desktop 10.7 is what I have been using and there's been no issues or errors loading data.

0 Kudos
EvanMyers1
Occasional Contributor

So after several failed attempts at getting the tool to work correctly I decided to do a full re-installation of ArcMap along with its python package.  Once I did that and restarted my machine, the tools appear to be behaving properly now.

Sometimes the most complex issues are solved the simplest ways.

0 Kudos