4

I am trying to use the ConcatenateRowValues tool provided by ESRI. My overall code for my script is working fine except when it tries to use the ConcantenateRowValues Tool. I start by importing the proper toolbox and then attempt to get my script to access it. Below is my code to do this:

arcpy.ImportToolbox("C:/Users/'USERNAME'/Desktop/BaseLayer/ConcatenateRowValue101/ConcatenateRowValues101.tbx")
arcpy.ConcatenateRowValues_AA(hlint, "SHORT_DESC", "NAME", "Hydro_Line", "-")

The Error that's returned is:

Runtime error Traceback (most recent call last): File "<string>", line 67, in <module> File "C:\Users\'USERNAME'\Desktop\BaseLayer\ConcatenateRowValue101\ConcatenateRowValues101.tbx", line 54, in ConcatenateRowValues /jVXV+BHwwJ5+Gfgv/wnbP8A+NV2Eo+ZTjHPQ9qlR60cIvojBSkupxw+Avwvz/yTTwX/AOE7Z/8A AttributeError: Object: Tool or environment <ConcatenateRowValues_AA> not found

This is a different error from when an invalid function name is called on arcpy:

>>> arcpy.ConcatenateRowValuesASDF_AA(hlint, "SHORT_DESC", "NAME", "Hydro_Line", "-")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ConcatenateRowValuesASDF_AA'

That means ArcPy is seeing the model but not wanting to run it. Why not? What's the reason for the Tool or environment <ConcatenateRowValues_AA> not found error?

2
  • 2
    I'd like to add that when using the tool as a python script after it's been exported it works perfect. This error only occurs when I put the Tool into a larger script.
    – MikPM
    Commented Jan 19, 2015 at 23:36
  • This may or may not be related. Unfortunately for your specific case, the toolbox is already built. But I tested the toolbox you're working with, and from everything I can tell, AA is the toolbox's built in alias.
    – jpmc26
    Commented Sep 27, 2016 at 16:57

2 Answers 2

3

It works for me if I explicitly specify an alias when calling ImportToolbox:

arcpy.ImportToolbox("C:/Users/'USERNAME'/Desktop/BaseLayer/ConcatenateRowValue101/ConcatenateRowValues101.tbx", "thealias")
arcpy.ConcatenateRowValues_thealias(hlint, "SHORT_DESC", "NAME", "Hydro_Line", "-")
1

I think you will need to re-examine the properties to check the name and alias that you gave to your tool and toolbox respectively.

From the ImportToolbox Help:

The tool is identified by the tool name and the toolbox alias

In your case:

arcpy.ConcatenateRowValues_AA

  1. Your tool should have a name of ConcatenateRowValues.
  2. Your toolbox should have an alias of AA

I am assuming that where your question says 'USERNAME' you have just post-edited that into your code and error, and are actually using a valid username.

1
  • 2
    I've double checked my syntax with the answer you've provided, everything is as it should be. The tool works outside my script but when I add it to the script I'm working on it doesn't seem to want to work.
    – MikPM
    Commented Jan 19, 2015 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.