Hi,
I am using ArcGIS Desktop 10.6 and would like to publish my python toolboxes using Creategpsddraft but I am running into problems in the very early stages. It cannot read my .pyt toolbox. I get the following error:
IOError: The toolbox file d:/temp/Toolbox.pyt was not found.
I have tried it on two different computers with the same result.
I have created the toolbox.pyt in ArcCatalog and haven't changed it.
import arcpy toolbox = "d:/temp/Toolbox.pyt" # toolbox = "d:/temp/Toolbox1.tbx" arcpy.ImportToolbox(toolbox)
If I uncomment the line and import the tbx (which also is just a default toolbox) it works ok.
According to this post it should work just fine.
Can someone please tell me what I am doing wrong!
Thanks Robert
Solved! Go to Solution.
I am going in a different direction now. Stumbled upon Daniel Garcia's answer in this thread. Which basically boils it down to this:
After the service has been published you can update the code, restart the service and your new code is active right away.
I'm not sure if there are any caveats yet. But it looks to me like a more developer friendly way of publishing geoprocessing services.
Now I easily can combine all my geoprocessing tools in one toolbox, and publish all at once.
Robert
I tried this both in the .pyt file:
class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" self.label = "Toolbox" self.alias = "Toolbox" # List of tool classes associated with this toolbox self.tools = [Tool]
And specifying it as the extra parameter in the ImportToolbox (or the AddToolbox) method. I still get the error that the file cannot be found.
Robert
perhaps a different name than Toolbox... no clue now, other than that
That doesn't help either.
Thanks for the help anyway...
You might use ArcCatalog to check the status of Toolbox.pyt. It there is an error in the toolbox, indicated by a red x in the catalog icon, it will give a "The toolbox file <Toolbox.pyt> was not found" message even if the path to the file is valid. You can right click in Catalog and "Check Syntax" of the tool.
It is a valid toolbox. Just the one generated in ArcCatalog. Haven't done anything with it .
I am going in a different direction now. Stumbled upon Daniel Garcia's answer in this thread. Which basically boils it down to this:
After the service has been published you can update the code, restart the service and your new code is active right away.
I'm not sure if there are any caveats yet. But it looks to me like a more developer friendly way of publishing geoprocessing services.
Now I easily can combine all my geoprocessing tools in one toolbox, and publish all at once.
Robert