Select to view content in your preferred language

Why does this model fail to find a .py file?

2348
6
Jump to solution
10-19-2015 09:03 AM
TheodoreRakel
Frequent Contributor

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:

tbx and py file folder.jpg

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.

model shows a red x in arc catalog.jpg

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.

model editor shows broken reference to py file.jpg

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.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
WesMiller
Deactivated User

Did you check the Store relative path names box?

View solution in original post

6 Replies
WesMiller
Deactivated User

Did you check the Store relative path names box?

TheodoreRakel
Frequent Contributor

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.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Is everything in the same location? ie scripts, models etc?

0 Kudos
TheodoreRakel
Frequent Contributor

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.

0 Kudos
TheodoreRakel
Frequent Contributor

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.

TheodoreRakel
Frequent Contributor

This corrected the problem.  I tested incorrectly at first but now I can see that this fixes the problem.  Thanks

0 Kudos