gabrisch

ArcToolbox scripts behave differently then the hard-coded versions.

Discussion created by gabrisch on Oct 14, 2011
Latest reply on Oct 18, 2011 by stacyrendall
I made a four color map algorithm for Python. When I execute the script in PythonWin, Komodo, or Idle, with the path to the feature class hard-coded into the script, things run fine. I know the syntax is correct. Once I add the script to ArcToolbox it throws an error (error message posted below). The error occurs at this line.

if (geometry1.touches(geometry2) or geometry1.overlaps(geometry2)) and counter != counter1:

File "E:\SCRIPT~1\MINIMU~1\minimumpolygoncolor.py", line 46, in <module>
if (geometry1.touches(geometry2) or geometry1.overlaps(geometry2)) and counter != counter1:

Error Info:
'unicode' object has no attribute 'touches'
ArcPy ERRORS:


I also developed a tool to remap data paths in an mxd. Again, things run fine if I post the code into the Python window. All the broken links are fixed. When I convert this tool to a Toolbox script, the paths get updated...and then removed from the mxd.

Does anyone know why a script would act differently once they are brought into ArcToolbox?

Outcomes