AnsweredAssumed Answered

Unsupported operand error writing to file

Question asked by recurvata on Dec 13, 2013
Latest reply on Dec 13, 2013 by recurvata
In the code below, I get a "TypeError: unsupported operand type(s) for +: 'NoneType and 'str'" on the f.write line. If I don't concatenate, it runs fine, but all the layer names run together.

I understand what the error means, but not why I'm getting a NoneType. I've tried casting to str, same result. All I'm trying to do is write out a text file of layer names. Any idea what's causing this and how to get around it? Thanks.

for lyr in arcpy.mapping.ListLayers(mxd, "", df):         f.write( + "\n"         count += 1