TypeError: cannot concatenate 'str' and 'NoneType' objects

Mark Peters mpeters42 at gmail.com
Wed Dec 20 14:33:17 EST 2006


> # Begin going through the loop
> Townshp = Townshps.next()
> while Townshps !="":
>     #Set the output name to be the same as input
>     outName = outputPath + "/" + Townshp + "land" + ".img"
>     Output_table = outputPath + "/" + Townshp + "table" + ".dbf"
>     #For each extract by Mask
>     gp.ExtractbyMask_sa (raster, Townshp, outName)
>     #For each tabluate area
>     gp.TabulateArea_sa (Townshp, "RITOWN5K_", outName, "VALUE",
> Output_table, "98.425")
>     Townshp = Townshps.next()

Warning: I know nothing about the Python ArcGIS stuff.

The first thing that jumps out at me is your while condition.  You are
testing "Townshps" when it seems from the code that you should be
testing "Townshp".  However, the typical Python way to iterate through
a list for be to use a for loop.
Perhaps replace the while statement with:
for Townshp in Townshps:
and remove the "Townshp = Townshps.next()" lines

If that doesn't do it, please post the entire traceback message that
you are seeing (copy and paste it) and it should tell us a lot more
about your error.




More information about the Python-list mailing list