Python - inputs for building composite address locator from address locators created

المشرف العام

Administrator
طاقم الإدارة
I'm building a script tool that creates up to 3 address locators and then uses the output address locators as inputs to the final output composite address locator. The tool executed perfectly prior to adding the code to build the comp address locator. As the tool builds the input address locators in a for loop, I cannot hardcode their names as the first argument for the create composite locator. Instead, I made a list that is populated as the tool loops to make the input address locators:

alNames =[]for ref in refData: baseName = os.path.basename(ref) outName = os.path.join(outPath,baseName) #this is the final argument for the create address locator tool ...all the code to make the address locator.... alNames.append(outName)arcpy.CreateCompositeAddressLocator_geocoding("alNames[0],alNames[1],alNames[2]","Street 'Street or Intersection' true true true 100 Text 0 0 ,First,#,alNames[0],Street,0,0,alNames[1],Street,0,0,alNames[2],Street,0,0;ZIP 'ZIP Code' true true false 10 Text 0 0 ,First,#,alNames[0],ZIP,0,0,alNames[1],ZIP,0,0,alNames[2],ZIP,0,0",outCompAdd)I'm getting the following error when I run the tool:

Traceback (most recent call last): File "N:\Python\Completed scripts\Create_Address_Locators.py", line 34, in arcpy.CreateCompositeAddressLocator_geocoding("alNames[0],alNames[1],alNames[2]","Street 'Street or Intersection' true true true 100 Text 0 0 ,First,#,alNames[0],Street,0,0,alNames[1],Street,0,0,alNames[2],Street,0,0;ZIP 'ZIP Code' true true false 10 Text 0 0 ,First,#,alNames[0],ZIP,0,0,alNames[1],ZIP,0,0,alNames[2],ZIP,0,0",outCompAdd) File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geocoding.py", line 138, in CreateCompositeAddressLocator raise eExecuteError: ERROR 000582: Error occurred during execution.When I run the tool without the quotes around the items from alNames[] I get an error message that the tool only takes up to 4 arguments and I provided 5.



أكثر...
 
أعلى