Select to view content in your preferred language

arcpy CalculateGeometryAttributes and AddGeometryAttributes returning OSError: "data" does not exist

2152
13
07-12-2022 08:42 AM
jwhaney
Emerging Contributor

So I've posted this in gis stackexchange because I had an easier time with their code editor. Not sure if it's against rules to post a link to that post, but I'm gonna do it anyway...

python 3 - ArcPy AddGeometryAttributes and CalculateGeometryAttributes return Traceback OSError: "da...

 

Essentially I'm having a problem as in the title here. Not sure what's going on and could use some help troubleshooting. I'll post the error below, but if you'd like to see my code please use the link above since trying to paste the code neatly here is a nightmare.

Error:

12 error --- Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\AddGeometryAttributes.py", line 396, in <module>
addGeomAtts = AddGeometryAttributes(fc, geomProperties, lUnit, aUnit, cs)
File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\AddGeometryAttributes.py", line 30, in __init__
desc = arcpy.Describe(fc)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 1287, in Describe
return gp.describe(value, data_type)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 384, in describe
self._gp.Describe(*gp_fixargs(args, True)))
OSError: "WY_testing.gdb\blobs_exp" does not exist

Failed to execute (AddGeometryAttributes).

0 Kudos
13 Replies
RhettZufelt
MVP Notable Contributor

What do you get if you put these statements right before the AddGeometry.....?

print(arcpy.env.workspace)
print("{}".format(blobs_exp))  # From your code
print('"{}"'.format(blobs_exp))  # added ' to get double quotes around replacement

 Should report the full path to the database.

also, should return just the dataset name for the second one. 

Documentation shows it with quotes around it, but the print of you code doesn't.  Don't think this has anything to do with it, but the third print statement adds the double quotes in case it needs it.

Main thing is to see what the workspace and blogs_exp resolve to right before the AddGeometry....

R_

 

 

0 Kudos
jwhaney
Emerging Contributor

edited:

printing the workspace prints exactly what is stored in the out_worskpace variable, "WY_testing.gdb" which is in root directory same as this script. in other words is a relative path, or that's what I'm going for. arcpy hasn't had any problems with this relative path so far, but does this tool need a full path?

0 Kudos
RhettZufelt
MVP Notable Contributor

Not sure on that one, I've been just testing on the console so have coded the path the the FGDB. 

I would replace it with the full path and see if it works.

Also, testing in Pro python window, it seems I can either set the workspace, then the name of the feature class, OR, I can use the full path to the feature class in the AddGeom.... tool and it works.

R_

0 Kudos
KalinaStoycheva
Occasional Contributor

From what I gathered for your out_workspace you have written the name of the geodatabase instead of the path to it. I think that is why it returns an error that it does not exists. Try writing the path to it like this Current Workspace (Environment setting)—ArcGIS Pro | Documentation  hopefully it should solve the problem.

0 Kudos