I 'm trying to automate the conversion of raster to polygon and the rasters files are in "TIF" format which is a "unsigned integer". I have the code below. However, I 'm getting an error while executing it. Could you have some suggestion please?


import arcpy, os
from arcpy import env
from arcpy.sa import *

#To overwrite output
arcpy.env.overwriteOutput = True

#Set environment settings
env.workspace = "C:/Subhasis/Test/Neshanic_Python/extract"


#checkout ArcGIS spatial analyst extension license

inraster = arcpy.ListRasters("*", "TIF")

for i in inraster:
    outPolygons= outws + str(filename) + '.shape'
    field = "VALUE"
    arcpy.RasterToPolygon_conversion(inraster, outPolygons, "NO_SIMPLIFY", field)

Error: Traceback (most recent call last): File "C:\Subhasis\Test\Neshanic_Python\extract\Clip.py", line 23, in arcpy.RasterToPolygon_conversion(inraster, outPolygons, "NO_SIMPLIFY", field) File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\conversion.py", line 241, in RasterToPolygon raise e

  • @artwork21. Thank you very much for editing my post! Do I need any software for this editing? if yes where do I get it?
    – Inception
    Jul 28, 2014 at 17:51
  • 2
    Shapefiles don't have the extension ".shape"; it's .shp
    – Paul
    Jul 28, 2014 at 17:56
  • also the formatting help page is here. gis.stackexchange.com/editing-help
    – Brad Nesom
    Jul 28, 2014 at 18:18
  • FYI, you also don't need to check out the spatial analyst extension to convert raster to polygons. It's core ArcGIS.
    – Fezter
    Jul 29, 2014 at 5:11

1 Answer 1


For this line:

arcpy.RasterToPolygon_conversion(inraster, outPolygons, "NO_SIMPLIFY", field)

You are inserting a list not an individual raster file, trying changing it to:

arcpy.RasterToPolygon_conversion(i, outPolygons, "NO_SIMPLIFY", field)
  • Yes, I did that stupid mistake.Thank you very much It worked! Another topic, How do I post my question so that you don't have to edit it? If I need anything to install,Where do i get it? Thank you!
    – Inception
    Jul 28, 2014 at 17:56
  • There should be text called edit under the question tags that you can click on to edit it.
    – artwork21
    Jul 28, 2014 at 18:00
  • good morning! Sorry to bother you. I may sound stupid, I was looking for the text "edit" to edit my code. But I didn't get it. I was wondering do I need to install something as I didn't see anything under "question tab". Thank you!
    – Inception
    Aug 1, 2014 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.