My project starts from a MXD containing Query Layers. I have to prepare the data in this "MasterMXD" for use in an offline application. Working with ArcMap 10.2.1 for this project. My Python script follows a simple structure:
- Loop over all layers in the MasterMXD.
- MakeFeatureLayer from the Query layer.
- FeatureClassToFeatureClass to store feature layer as a feature class.
- Continue from there to CreateRuntimeContent later in the script.
Here is part of my Python script:
for df in arcpy.mapping.ListDataFrames(master_mxd): for lyr in arcpy.mapping.ListLayers(master_mxd, data_frame = df): lyrName = lyr.name.encode("ascii", "ignore") lyrName = lyrName.replace(" ", "") featureLyr = arcpy.MakeFeatureLayer_management(lyr, lyrName) arcpy.FeatureClassToFeatureClass_conversion(featureLyr, outFolder, lyrName)
The problem I am facing is that some of the layers in the MXD pass through the script without problem, while others give an error 000229:
ERROR 000229: cannot open GPL0 for the MakeFeatureLayer_management tool.
It is always the same layers that give the error.
I cannot see any differences between layers that give this error and the layers that do not give it. I did not construct the database that serves the query layers and cannot find any 'GPL0' anywhere. I'm puzzled!
Does anyone have an idea what is causing this ERROR 000229 showing up for some of my query layers in the