Hi,

I am having trouble trying to create an ArcGIS tool. The script is getting an error when I tell it is import a text file and display XY coordinates. The tool fails here but the code itself will run in the python window without error.

Here is the code:

import os

import sys

import arcpy, glob

arcpy.overwriteoutput = True

Input = arcpy.GetParameterAsText(0)

from arcpy import env

### projection in designated folder #####

projection = "C:\\Users\\awooditc\\Desktop\\Misc\\AVL\\WGS 1984.prj"

##Name AVL datafile (tool requires a text file format)#####

AVLdata = arcpy.GetParameterAsText(1)

## import data stored in a txt file, create shapefile

arcpy.MakeXYEventLayer_management(AVLdata, "Longitude", "Latitude", AVLdata, projection, "")

###Code stops here with error:

Traceback (most recent call last):

File "C:\Users\awooditc\Desktop\Misc\AVL\LASER AVL Data Tool.py", line 26, in

arcpy.MakeXYEventLayer_management(AVLdata, "Longitude", "Latitude", AVLdata, projection, "")

File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 7112, in MakeXYEventLayer

raise e

ExecuteError: Failed to execute. Parameters are not valid.

ERROR 000840: The value is not a Feature Layer.

Failed to execute (MakeXYEventLayer).

Anyone have a suggestion for how to fix this? The GetParameterAsText(1) is set to require a text file.

Thanks!

Similar questions and discussions