AnsweredAssumed Answered

Write to file

Question asked by jdrvar on Oct 1, 2013
Latest reply on Oct 7, 2013 by jdrvar

I am selecting records within a Feature Class.  Then, creating a script to write values for selected fields to a text file. I receive a Type Error:coercing to Unicode: need string or buffer, None Type found.  The script works until null values are encountered. How can nulls be accounted for and written to a text file?  The fields TOWNSHIP, RANGE, SEC, SUBCODE, BLOCK, and LOT are string field types.  Null values can be found within the BLOCK and LOT fields. 

cursor = arcpy.da.SearchCursor(par, ["TOWNSHIP", "RANGE", "SEC", "SUBCODE", "BLOCK", "LOT", "OBJECTID"]) for row in cursor:  f1 = open("E:\\Working\\Python\\SubRep3.txt", "w")  f1.write(row[0] + row[1] + row[2] + row[3] + row[4] + row[5])  f1.close()  del row  del cursor