AnsweredAssumed Answered

Error 000732 when trying to use GetParameterAsText in python script tool

Question asked by andrewrowlands on Aug 30, 2016
Latest reply on Aug 30, 2016 by Dan_Patterson

I'm attempting to write code to run a buffer and drive time analysis on an XY data file and then count features from another shapefile within the drive time trade area that's created. I'm attempting to use the Spatial Join (Analysis) for the latter process. I'm currently having an error with my code at the Spatial Join part of the code. It says the dataset "false" does not exist, which is not a dataset that I'm trying to use or am even aware of. Here is the error message with the key details:

 

Traceback (most recent call last):
File "Y:\BI\GIS Data\GIS Data Backup\Python Scripts\InternalModel_PythonScript_SingleSite.py", line 121, in <module>
arcpy.SpatialJoin_analysis(targetFeaturePoly, joinSpatialConvStores, outPolyCStorePoints)
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\analysis.py", line 471, in SpatialJoin
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Join Features: Dataset false does not exist or is not supported
Failed to execute (SpatialJoin).

 

I will say, this script runs properly when I do not see the final parameter, but instead link directly to the file path in the code. It's once I try to use GetParameterAsText when the error occurs. Here is the code attached. The error is occurring in this section. When I remove the comment from line 3 and run the script directly setting that variable to the shapefile, it works fine.

 

#create layers for summarize within function; pull number of c-stores within drive time polygon
joinSpatialConvStores = arcpy.GetParameterAsText(2)
#joinSpatialConvStores = r"X:\Users\Andy.Rowlands\AHR.Data\MPSI_KalibrateData\MPSI_Competition_Locations\2015Surveys\DesMoines_2015_locations.shp"
targetFeaturePoly = fcDriveTimeAppend
businessPointsString = "CStoreCount_"
outPolyCStorePoints = businessPointsString + fcLocation
arcpy.SpatialJoin_analysis(targetFeaturePoly, joinSpatialConvStores, outPolyCStorePoints)
print ("CStore Count Done")

Outcomes