arcpy: program crashes on intersect

697 views Asked by At

I am writing a program that takes the input of two shape files that were exported with pgsql2shp.exe and does the intersection between them. Here is my code

print sys.argv[1], sys.argv[2]
intersection = ''
arcpy.Intersect_analysis([sys.argv[1], sys.argv[2]], intersection, "ALL")

where sys.argv[1] and [2] are absolute paths to the .shp files being intersected. e.g. U:\proj\a.shp and U:\proj\b.shp

It compiles but when run gives

Traceback (most recent call last): line 45, in arcpy.Intersect_analysis([sys.argv[1], sys.argv[2]], out_path, "ALL") line 289, in Intersect raise e arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Output Feature Class: Value is required Failed to execute (Intersect).

How do I fix it and where do I access the return value? I want to put the result in a table in a database. I'm new to Python, ArcPy and GIS.

1

There are 1 answers

4
Todd Minehardt On

You've set the name of the output feature class to be an empty string. Try:

intersection = "Intersect_Output"

The output feature class (here, Intersect_Output) will be written to the geodatabase you're working in.