OK!! I see the problem now! I also did a little change to the code, I open the .txt before the for stamentet. The script is working properly gdal.AllRegister() file_list = [ folders = Non for root, folders, files in os.walk( "C:\\" ): file_list.extend(os.path.join( root,fi) for fi in files if fi.endswith(".shp")) f = open('csv_pruebita.csv', 'wb') log = open ('errors.txt','wb') writer = csv.writer(f) ruta = 'Ruta' archivo = 'archivo' prj = '.prj' proyeccion = 'proyeccion' campos = [ruta,archivo,prj,proyeccion] writer.writerow(campos)
for row, filepath in enumerate(file_list, start=1): #Partir la ruta del archivo en dos, ruta y nombre del archivo (ruta, filename) = os.path.split(filepath) #Escribir el nombre del archivo shapeData = ogr.Open(filepath) shp = 'Error al abrir el archivo' +filepath #Abrir archivo de errores if shapeData is None: print shp log.write(shp+"\n") #Obtener la capa del shape else: ......
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor