I have a .pyt Python toolbox which runs fine in ArcMap and then gives the dreaded "ERROR 000816: The tool is not valid" when published as a GP Service. I've dealt with this issue many times before, but this one is exceptional.

If I run ArcMap as the arcgis service account user (Shift - Right click - Run as different user) and inspect the actual GP service code that ESRI creates, the .pyt is fine and runs with no issue, but the derived .tbx has red x's. I can't think of any reason why or any way to tell what the problem is.

Screen shot of .pyt and .tbx from Arcmap

The "extracted" .pyt also runs fine from the command line (run as arcgis service account user with debug code in the if __name__ == "__main__": block. Running with 64 bit python and import arcserver at top of script).

This is on ArcGIS Server/Desktop 10.3.1.

  • If you're in ArcMap looking at this drag the gpservice_check.rlt into ArcMap. It'll show up in the results window under shared. Can you run it from there? Everything you describes points to publishing working but the task which gets created (which is what server actually uses) isn't right – KHibma Dec 4 '15 at 14:20
  • @KHibma I tried that and it does show up under shared and shows all the tool metadata - however if I try to run one of the tools it pops up a window which says "Unable to execute the selected tool". Similarly, if I use arcpy.ImportToolbox in the python console and try to run one of the tools, I get the same "Tool is not valid error". You are right that the task that gets created is not valid. I just have no idea why or how to figure out why. – Josh Werts Dec 4 '15 at 14:24
  • Maybe unrelated: but you have 5 tools in that pyt. Did you run each and add each into the single service you made, or did you just publish a service with one tool (task)? However you did it try the opposite to see if it narrows it down? – KHibma Dec 4 '15 at 14:31
  • @KHibma Little progress - commented out all of the tasks except for one and was able to publish successfully. Helpful, but still not sure what the overall issue is. Takes forever to publish so not too thrilled about re-publishing piece by piece. – Josh Werts Dec 4 '15 at 15:20
  • @jwerts Have you same version of python and existing libraries called in your script in your server? Next check if function called in script use accepted level licencing set in your server – GeoStoneMarten Dec 4 '15 at 16:12

Your Answer

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

Browse other questions tagged or ask your own question.