import arcpy with open("e:\\filename.txt", "w") as f: f.write("my_list_of_files_as_a_string") arcpy.SetParameter(0, f)
# Import system modules import os # Import ArcGIS module import arcpy # Get the parameters folderName = arcpy.GetParameterAsText(0) destTxtFile = arcpy.GetParameterAsText(1) # Create list of files in the directory listFiles = os.listdir(folderName) # Open output txt file with open(destTxtFile,'w') as txtfile: # Loop through the list of files for fileName in listFiles: baseName = os.path.basename(fileName) (nameRoot,ext) = os.path.splitext(baseName) if ext == ".asc": txtfile.write(baseName) #arcpy.SetParameter(1, txtfile)
Hey all,
An easier fix that I discovered would be to turn off the logging history by using the line:
arcpy.SetLogHistory(False)
The documentation for its use can be found here:
SetLogHistory—Help | ArcGIS Desktop
Hope it works for you
Cheers