Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Python toolbox - some strange behaviours

$
0
0
I am trying to build a python toolbox. See the attached file (just turn the .py extension .pyt)

I am having a couple of issues:

1. I get error messages that the parameters[1].valueAsText property doesn't exist on my multivalue parameter, but I found on a forum once the exportToString() method that I'm using and it seems to work. The .value property comes accross as empty if I try to access it directly.

2. When I try to Add my toolbox to the ArcToolbox window in ArcGIS, it shows an X on it in the browse window, which should indicate a code error that prevents it from loading, however, when I comment out all the code in the execute routine, load it, uncomment out the code, re-save the file and right-click --> refresh in the ArcToolbox, it loads just fine and runs. So there are no code errors that should prevent it from loading in the first place.

3. I'm using a cursor. According to the documentation on those, using the WITH command should eliminate the need to do garbage cleanup to release the locks on the data, however that didn't seem to be the case. I tried adding commands to set the row and the cursor to None after they were not needed, but that didn't help. The behaviour I get is that the first run works fine, but on the second run, the layer I ran it on the first time doesn't appear in the layer list on the parameters dialog. It's like it knows it's locked and can't use it, so it decides not to display it.

For those who like to know such things, I'm running ArcMap 10.1 SP1 for Desktop, Build 3143, on Windows 7 SP1, on a Dell Optiplex 990, with 16 GB of RAM, and two Intel i7-2600, 3.40 GHz cores.


Any help or suggestions would be greatly appreciated. I'm getting pretty frustrated right now.
Attached Files

Viewing all articles
Browse latest Browse all 2485

Trending Articles