Integrate Tool in Python

2563
2
09-03-2012 01:36 AM
BenjaminKraus
New Contributor
Hi,

I'm trying to use the Integrate Tool in python (stand-alone script). I always get an Error message... I already tried to run the script different ways...no success

# Import arcpy modules
import arcpy
from arcpy import env

# Set workspace for Input and Output Data
env.workspace = "C:/Users/kraus-b/Desktop/polygon generalisation"

# Define Input and Output Files
soilclass = "C:/Users/kraus-b/Desktop/polygon generalisation/Input/soilclass.shp"
integrateFeatures = "C:/Users/kraus-b/Desktop/polygon generalisation/output/soilclass_copy.shp"

# CopyFeature (input, output)
arcpy.CopyFeatures_management(soilclass, integrateFeatures)
 
# Execute Integrate
arcpy.Integrate_management(integrateFeatures, "3 Meters")


Traceback (most recent call last):
  File "C:\Users\kraus-b\Desktop\forum.py", line 28, in <module>
    arcpy.Integrate_management(integrateFeatures, "3 Meters")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 1702, in Integrate
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000735: Input Features: Value is required
Failed to execute (Integrate).



I tried to use the  Integrate Tool in the Python Shell in ArcMap... it works.

I also tried to export the Integrate Script from the Modelbuilder to Python. It works in the Modelbuilder but not as a stand-alone script. When I export the Script, it makes a # after the Input. It stands for the rank of feature classes if there are more than one input feature class.

The exported script from Modelbuilder:
# Import arcpy module
import arcpy

# Local variables:
soilclass_copy = "soilclass_copy"

# Process: Integrate
arcpy.Integrate_management("soilclass_copy #", "3 Meters")


I also tried following code
arcpy.Integrate_management("C:/Users/kraus-b/Desktop/polygon generalisation/output/soilclass_copy.shp #", "3 Meters")


--> same ERROR message

I also tried to copy the code from the example in the Desktop Help - no success

I'm not a python expert but usually I'm able to use simple gis tools in python. In this case I'm helpless.
Any Ideas?

Thanks in advance
Benjamin
Tags (2)
0 Kudos
2 Replies
ChristopherThompson
Occasional Contributor III
Is it possible that the space and/or the hyphen in your path that you specify here:
integrateFeatures = "C:/Users/kraus-b/Desktop/polygon generalisation/output/soilclass_copy.shp"

is causing issues? Generally I think its advisable to avoid paths that include spaces or use 'special' characters.  another thought is that the number of characters in the path might be problematic.  You might try this in a directory you create that is very simple, like "c:\data".
0 Kudos
BenjaminKraus
New Contributor
Thanks a lot Christopher!!

Removing the space in the path solved the problem!
0 Kudos