lgtateos

ListFiles called within a script tool..Bug?

Discussion created by lgtateos on Apr 13, 2012
Hi fellow GIS Pythoners,

I run the following script in PythonWin and get a list of 5 text files in my input directory.  I run the same script with the same input directory via a script tool (set up with one required string argument) and get an empty list.  Seems like a ListFiles bug, but I can't find anyone talking about it.  BTW, if I replace txtList = arcpy.ListFiles("*.txt") with txtList = arcpy.ListFeatureClasses(), it works correctly in both domains.  I'm using Arc10 Service Pack 4.
import arcpy, sys
arcpy.env.overwriteOutput = 1
arcpy.env.workspace = sys.argv[1]
txtList = arcpy.ListFiles("*.txt")
print txtList
value = raw_input("Press Enter")

Outcomes