Using Windows reserved words ruined my ArcMap and ArcGIS Pro

498
0
11-21-2019 05:34 AM
OguzSariyildiz
Occasional Contributor

I created an Arcpy script to generate point shapefiles for different watersheds.

I used split by features to create single watersheds. Each watershed has unique 3 letter code and I used that code to split features. I was not able to create single watershed shapefiles but I was able to create feature class in a geodatabase. 

Then, I used these 3 letter codes feature class to create point shapefiles as boundary for each watershed in a loop. I realized when it comes to 'CON' loop stopped. 

import arcpyfrom collections import defaultdict  
geo_db
= 'C:\\CHIA_Routine\\CHIA_Watersheds.gdb'
smis_wq_resultsXY = geo_db + 'smis_wq_resultsXY'huc12_370 = geo_db + '\\HUC12_370'
with arcpy.da.SearchCursor(huc12_370, ['WatershedD', 'CIAMaster', 'Code3', 'HUC_12']) as cursor:
   n
= 1
   
for row in cursor:
   watershed_report_dic
[row[0]] = [row[1], row[2], row[3], n]
   watershed_shp_dic
[row[1]] = [row[0], row[2], row[3], n]
   n
= n+1
for watershed in watershed_shp_dic.keys():
   code3
= watershed_shp_dic[watershed][1]
   code3_prefix
= main_folder + '\\' + 'Watershed_DataSets' + '\\' + watershed_shp_dic[watershed][0] + '\\' + code3
   code3_path
= main_folder + '\\' + 'Watershed_DataSets' + '\\' + watershed_shp_dic[watershed][0]
   arcpy
.Clip_analysis(smis_wq_resultsXY, geo_db + '\\' + code3, code3_prefix + '.shp')

I checked if 'CON' reserved word in ArcGIS product but it was not. Finally after three days I figured 'CON' was a Windows reserved word and that was the causing issue. 

Windows doc

However, now my geodatabase system ruined and Split by Attributes tool does not work anymore. It only generates the tables but no geometry. Also, my geodatabases look like folder instead of geodatabase symbol. Both ArcMap and ArcGIS Pro messed up. 

I figured if I do not use these Windows reserved words my code works but I have lost quite some time to find the issue. I need to finish this project as soon as possible. Is there any quick fix for this problem. 

0 Kudos
0 Replies