My code is:
with arcpy.da.SearchCursor("txtFilePath", ["Field1", "lotsOFOthers"]) as cursor: for row in cursor: val = "%s" % row ... non related code which selects a few values newTextFile.write(val + "\n")
My issue is that field 1 is a mix of integer and string values, and sometimes the values that are strings get written out as nulls. There is literally nothing written out for that value. I strongly suspect that this is due to Arc seeing only integer values in the first few records and surmising that the field is type int, and then when it tries to read a string it fails.
My question is, is there a way to make sure this won't fail? I know from experimentation that this works when some or all of the first ten records contain strings; in that case both integer values and string values are written out correctly.
I understand I could read and write csv files without using cursors, but is there a way to do this while still using da.SearchCursor?