I have an arcpy script that uses a XTools Pro geoprocessing tool, which works if I run it from ArcMap (with the XTools Pro extension enabled), but if I run it outside of ArcMap I get an error.

Tool I'm running:

arcpy.ImportToolbox("C:/Program Files (x86)/DataEast/XTools Pro/Toolbox/XTools Pro.tbx")
arcpy.XToolsGP_DispersePoints_xtp(InputLayer, OutputLayer, "0.25 Meters", "1 Meters", "BY_CLUSTERS", "RING", "", "")

Error message:

arcgisscripting.ExecuteError was unhandled by user code
Message: Failed to execute. Parameters are not valid.
ERROR 000824: The tool is not licensed.
Failed to execute (XToolsGP_DispersePoints).

I have attempted to enabled this extension from arcpy with no success, and have found the XTools Pro help pages don't mention arcpy at all (so now I wonder if it's even supported).

How can I enable the XTools Pro extension from within arcpy? I've attempted to use the following, but am unsure what arcpy would call the XTools Pro extension, so may be using the incorrect Extension name. (I have tried XTools, XToolsPro, XTools-Pro, XTools Pro, xtp, XToolsGP)

if arcpy.CheckExtension("XToolsPro") == "Available":
    print "XTools Pro Not Available"

You need to load the XTools Pro toolbox using the arcpy.ImportToolbox() function. The toolbox is usually located in the C:\Program Files (x86)\DataEast\XTools Pro\Toolbox folder; assuming this is the case, add the following statement at the top of your code (after importing arcpy):

arcpy.ImportToolbox('C:\Program Files (x86)\DataEast\XTools Pro\Toolbox\XTools Pro.tbx')

If you're just using the Python window in ArcMap, just type the above into the interpreter and the toolbox will be imported.

Once the toolbox is imported, its tools are accessed using the syntax arcpy.xtp.toolname

enter image description here

  • Sorry I forgot to include that line in my question - I already had the toolbox imported: arcpy.ImportToolbox("C:/Program Files (x86)/DataEast/XTools Pro/Toolbox/XTools Pro.tbx") – Midavalo Feb 23 '16 at 0:37
  • your code should reference the module name "xtp" so you would use arcpy.xtp.XToolsGP_DispersePoints(InputLayer, OutputLayer, "0.25 Meters", "1 Meters", "BY_CLUSTERS", "RING", "", "") – Adam Feb 23 '16 at 0:42
  • 1
    wow. you've got me then! – Adam Feb 23 '16 at 1:52
  • 1
    Thanks for all your help and suggestions @adam. My script was correct all along, however it turns out that XTools won't work with 64bit python. I was trying to rule it out so I switched python to 32bit and it all worked flawlessly! Much appreciated. – Midavalo Feb 25 '16 at 22:04
  • 1
    wow that's pretty surprising really. glad you got it sorted! – Adam Feb 25 '16 at 22:47

XTools Pro geoprocessing tools require 32bit python, and won't work if using the 64bit background geoprocessing. Switching to 32bit worked.

It seems that when using 64bit python XTools Pro reports The Tool is not Licensed however this is misleading in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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