i've been searching arround all the answers in the questions of Error 358 and beyond, but i doesn't fix my problems, i tried every post and so on the problems stills there.
I make two options in my code, one make the error 358 appears, and the other option make the error 999999 with invalid SQL. If i put the code "by hand" in the SelectLayerByAttribute_management it works, but i need to be an input by the user. The query its the same by hand and by the script and i dont know how to make it run.
Sorry for the english, not my maternal lenguaje.
The code is:
Zona_trab=raw_input("Introduzca la ruta de la GDB/carpeta sobre el que se trabajara") arcpy.env.workspace = Zona_trab CapaObj=raw_input("Introduzca el nombre de la capa de tuberias") CapaArq=raw_input("Introduzca el nombre de la capa de arquetas") puntos = raw_input("Introduzca las arquetas con datos de permalogs, separadas por espacios: ") query = '' first = True for punto in puntos.split(): if not first: query = query + 'OR ' query = query + '\\"FID\\" = ' + punto + ' ' first = False query = '" '+query+' "' TempCarp="C:\\Trabajo Carto\\TempPrograma" arcpy.MakeFeatureLayer_management(CapaObj,"capa tuberias") arcpy.MakeFeatureLayer_management(CapaArq, "capa puntos") arcpy.SelectLayerByAttribute_management("capa puntos","NEW_SELECTION", query) arcpy.SelectLayerByLocation_management("capa tuberias", "WITHIN_A_DISTANCE","capa puntos","1 Meters", "NEW_SELECTION") arcpy.FeatureClassToFeatureClass_conversion("capa tuberias",TempCarp,"Final.shp","","","")
The second option, wich give me a error 999999 its deleting the arcpy.SelectLayerByAttribute_management("capa puntos","NEW_SELECTION", query) and making the selection in the arcpy.MakeFeatureLayer_management(CapaArq, "capa puntos", query) this makes the error goes in arcpy.SelectLayerByLocation_management("capa tuberias", "WITHIN_A_DISTANCE","capa puntos","1 Meters", "NEW_SELECTION").
I hope get some response because i'm stuck in there :(
Aucun commentaire:
Enregistrer un commentaire