In Arc GIS 10.2.1, I've written custom toolbox which contains a model which in turn makes use of a .py file that lives in the same folder as the toolbox .tbx file, as shown below:
When I copy the folder with the .tbx and .py files to a new machine in order to run the model, the model APSAddDataAreaToLasDataset displays a red x next to it indicating that it has a problem.
The problem seems to be that the model cannot find the file AddShapeConstraint.py that it needs. The tool AddShapeConstraint has a red x next to it in the Model Builder editor. Also the Edit option is missing from the Properties of the tool in model builder, shown below.
If I remove the tool AddShapeConstraint from the model and then add it back in from the Insert->Tool menu item, then the model can find the .py file and everything works. Does anyone know why the model cannot find the .py file, and therefore I must delete and then add back the tool to the model whenever I copy this custom toolbox and its .py files to a new machine?
The problematic file AddShapeConstraint.py is attached.
Solved! Go to Solution.
Did you check the Store relative path names box?
I did NOT check the Store relative path names box. I changed to having the Store relative path names box checked, but it stills behaves the same way.
Is everything in the same location? ie scripts, models etc?
Yes, all files are in 1 folder. In fact, there's a second model in the custom toolbox I wrote that uses a .py file and it works fine. I can't see any difference between the one that works and the one that doesn't. Except for the 'store relative path names' check box. That was unchecked but I changed it to checked and still get the same behavior. Leaving that unchecked would explain the problem, I suppose, but that oversight has been addressed.
I should have mentioned that I developed the custom tool box and models on a 32 bit machine. That's what the client provided me with. The custom toolbox gets copied to 64 bit machines. This could account for the issue. I'm going to get this to work on a 64 bit machine properly and stop using the 32 bit machine. This may fix the problem, but if it does I don't know why.
This corrected the problem. I tested incorrectly at first but now I can see that this fixes the problem. Thanks