Hi
I am trying to read and use the geometries of a polygon layer, row by row, using Search Cursor. I am getting a very strange runtime error, but I cannot figure out the source of this error! My first time getting this runtime error!
Traceback (most recent call last):
File "C:\Documents\ArcGIS\Projects\Census\Redistribute_Home.py", line 75, in <module>
with arcpy.da.SearchCursor(from_shape, ['SHAPE@', 'FIRST_city', 'FIRST_ccid', 'FIRST_NUMBER_OF_DIVISIONS']) as search:
RuntimeError: cannot open 'ON1996_DissolveOnName'
First time seeing this runtime error. It says it cannot open the layer, but there isn't anything striking me to be wrong in my code!
# this is the workspace
arcpy.env.workspace = os.path.join(directory, gdb + '/' + fds) # gdb and fds are text strings
# the layer to create divisions from
from_shape = layer # 'ON1996_DissolveOnName' is the value of the layer
Again, here is the part of the code that runs into error
with arcpy.da.SearchCursor(from_shape, ['SHAPE@', 'FIRST_city', 'FIRST_ccid', 'FIRST_NUMBER_OF_DIVISIONS']) as search:
Another question is whether using SHAPE@ token to read the geometry for each of the
Solved! Go to Solution.
Actually there was an error in the path... hard to see!
The error is telling you that it can't open ON1996_DissolveOnName, probably because it can't find it.
So:
To post code:
Hmmm... the path to the file is correct, and the file is there! This is what makes it very strange...!!
Actually there was an error in the path... hard to see!
Oh, also, your second question got cut short:
Another question is whether using SHAPE@ token to read the geometry for each of the
Sorry, it is perhaps an irrelevant question now.