data does not exist error with MakeXYEventLayer

Discussion created by dodgyshamrock on Jul 21, 2011
Latest reply on Jul 22, 2011 by dodgyshamrock
Maybe I'm missing something very obvious, but I cannot get the following script to work.  I keep getting an error that the data does not exist or is not supported.  I have checked the path for the dbf file and there are no spaces and the dbf file does exist.  It seems like the MakeXYEventLayer command is simply not working.  Any suggestions?

arcpy.env.workspace = "L:/Projects/eagle/GoldenEagles/Locations2011/LocationDBFs"
outpath = "L:/Projects/eagle/GoldenEagles/Locations2011/test"

#Get dbf filename from user and set local variables
dbfFile = "locs_july8_july17_2011.dbf"
x_coord = "LATITUDE"
y_coord = "LONGITUDE"

#Get date range from user
date1 = "July8"
date2 = "July17"
daterange = date1 + "_" + date2
outLyr = outpath + "/" + daterange

# Set the spatial reference
prjFile = os.path.join(arcpy.GetInstallInfo()["InstallDir"],
                       "Coordinate Systems/Geographic Coordinate Systems/Spheroid-based/GRS 1980.prj")
spRef = arcpy.SpatialReference(prjFile)
outPrjFile = os.path.join(arcpy.GetInstallInfo()["InstallDir"],
                          "Coordinate Systems/Projected Coordinate Systems/UTM/NAD 1983/NAD 1983 UTM Zone 19N.prj")
outcoordsys = arcpy.SpatialReference(outPrjFile)

#Import xy data into ArcMap
    #print outLyr
    arcpy.MakeXYEventLayer_management(dbfFile, x_coord, y_coord, outLyr, spRef)
    print str(outLyr)
    print arcpy.GetCount_management(outLyr)


Amy Meehan
Wildlife Biologist
Maine Dept. Inland Fisheries and Wildlife
Bangor, Maine