Python Toolbox causes serious Application Error in ArcCatalog

737
6
08-29-2013 12:13 AM
EssamElhalhuli
New Contributor
I have an intermittent error, which other colleagues have experienced as well, where having created working python toolboxes ArcCatalog 10.1 will crash on opening with a serious application error. I then delete the Normal.gxt file, which restores ArcCatalog but I cannot see the python toolboxes. Oddly eventually they do reappear, usually after a few uses of arcmap, and will function again. I find the crash is far more likely to happen if I am testing toolboxes but this is not always the case.

Furthermore I do not get this issue if I use the python toolboxes in ArcMap, they are always present and always work.

Has anyone experienced this issue and if so know how to resolve it?
Tags (2)
0 Kudos
6 Replies
DaveBarrett
Occasional Contributor
Hi,

I haven't had the exact issue but I have had development python toolboxes kill ArcCatalog with a serious error. I managed to track this error down to a function I was calling from an additional module having an error. I have notices that when you use an Python Toolbox in ArcCatalog the tools and any additional .py files used by the tools are compiled when you open Catalog not when the tool is run. If there is an error in the .pyt file you just get a red cross. If however the error is outside of this structure I believe that this is the source of the crash.

I would guess that the toolbox is registered in the gxt file when you create the toolbox and until it is removed or the gxt re created the problem may persist.

Have you had any further instances of this error. Be interesting to see if anyone else has had this problem.

Cheers

Dave
0 Kudos
curtvprice
MVP Esteemed Contributor
]I have notice(d) that when you use an Python Toolbox in ArcCatalog the tools and any additional .py files used by the tools are compiled when you open Catalog not when the tool is run. 


This actually  makes a lot sense, because the .pyt would have to be imported for you to be able to browse the toolbox in catalog. For that reason, I would expect a compile/import when you browsed the folder in ArcMap as well.

I have not warmed to .pyt development because of difficulties like this.

In case you haven't found it yet, I have found this blog post helpful:

ArcGIS Blog 2012/12/14: How to Debug Python Toolboxes in 3 Easy Steps
0 Kudos
DaveBarrett
Occasional Contributor


In case you haven't found it yet, I have found this blog post helpful:

ArcGIS Blog 2012/12/14: How to Debug Python Toolboxes in 3 Easy Steps


Curtis,

Thanks for the link really helpful. I like some of the options available in the .pyt but got a few problems to work through. I'm heading down the site-package route to distribute our tools so it fits pretty well with the .pyt

Thanks

Dave
0 Kudos
EssamElhalhuli
New Contributor
Thank you for the responses.

Does anyone have any ideas why this does not happen in the ArcCatalog window from ArcMap?
Because these pyt run perfectly fine from ArcMap (and most of the time from ArcCatalog) I am a bit stumped as to where to look for any coding errors?
0 Kudos
DaveBarrett
Occasional Contributor
Evening all,

I have had a bit more of a dig into this problem and possible solutions. I found this link in the forums that appears to show that there is a bug at 10.1 with loading python toolboxes.

http://forums.arcgis.com/threads/91593-New-Python-Toolbox-will-Crash-Arc-Catalog?highlight=python+to...

This is supposed to have been fixed at 10.2 but not tested that yet. I have also found that this will cause ArcMap to crash in the same way if you add a python toolbox to ArcToolbox and save the settings to default.

The work around is to delete the ArcToolbox.dat file stored in the user profile.

C:\Users\[USER NAME]\AppData\Roaming\ESRI\Desktop10.1\ArcToolbox\ArcToolbox.dat

There are a couple of methods to fix ArcCatalog if this happening. Either remove the python toolbox from the last location you were using before encountering the problem or edit the following registry to change the last used location.

HKEY_Current_User\Software\Esri\Desktop10.1\ArcCatalog\Settings\LastLocation

The registry option worked for me and then I set the ArcCatalog option to forget the last used location. This is found at

Customize|ArcCatalog Options then go to the general tab and at the bottom is a check box that is called:

Return to last used location when ArcCatalog starts up.

From all the testing and reading I have carried out this problem only seems to happen when the Applications are loading not when accessing a functioning toolbox after they have opened.

Hope this is useful

Dave
0 Kudos
EssamElhalhuli
New Contributor
Dave,

I appreciate you following up on this, thank you.
I will share the work around with colleagues and hopefully see an end to this issue
0 Kudos