Iterate through rows and update cursor

877
4
Jump to solution
01-31-2023 01:56 AM
MarcEsmeijer
New Contributor II

Dear all,

I am writing a small Python script in ArcGIS and I am trying to loop through rows as can be seen in the figure below. However, I recieve an error saying that my file does not exist, even though I have copied the file path. The file has a data type: 'File Geodatabase Feature Class'.

I have also exported this feature class as a .shp shapefile. However I still recieve the same error.

So my question is how can make sure that my file is found so that my code works (if it is written correctly).

 

Error_file_no_exist.PNG

 

Thanks in advance!

Kind regards,

Marc

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

a shapefile would be in a folder and the *.shp file extension would be expected

your path contains spaces which isn't good and leading numbers for folders aren't great either.

Is the W drive local? a zip drive etc.

The file path, when you create a new one, should be raw encoded, (the little preceeding 'r') so try putting the shapefile into a simple folder path like

r"c:\data\my_shapefile.shp"


... sort of retired...

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

a shapefile would be in a folder and the *.shp file extension would be expected

your path contains spaces which isn't good and leading numbers for folders aren't great either.

Is the W drive local? a zip drive etc.

The file path, when you create a new one, should be raw encoded, (the little preceeding 'r') so try putting the shapefile into a simple folder path like

r"c:\data\my_shapefile.shp"


... sort of retired...
MarcEsmeijer
New Contributor II

Thankyou it worked!

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Dan mentioned several potential issues, please elaborate on what specifically "it" is that worked.

0 Kudos
MarcEsmeijer
New Contributor II

Replacing the spaces within the pathname by an undersquat made sure that the error dissapeared and the code could run.