End-of-line (EOL) Problem

11058
20
Jump to solution
02-15-2012 10:22 AM
NickJacob
New Contributor II
Came across a weird EOL Error with Arcpy's CalculateField_management() function today and I was wondering if anyone out there could point me towards a work around?

I previewed one of my tables in Catalog and at first glance the offending cells seemed fine.  However, when I copy/pasted one over to a text file a lot more text became visible. My current theory is that the Enter key is being hit when my customers edit cells in MS Excel (my typical source data) and invisible newline characters are being carried into my geodatabase tables.  Tricky thing is I can't see them in Excel or Arc, so I'm not sure how to strip or replace the backslashes via Python.

Any advice would be much appreciated,
- Nick
Tags (2)
20 Replies
curtvprice
MVP Esteemed Contributor
Why does the field calculator for Python reject standard strings with \t , \n, etc. characters?

What is the point of castrating Python's string operators?


This is a limitation of the ArcGIS geoprocessing tool setup, which has to pass all tool parameters in string representation. The expression and code block are Calculate Field tool parameters. (String reps are easily used to pass tool parameters across the web, XML, etc.)

The fix is to use the chr() function instead of escape codes in your expression or Calculate Field code block.
0 Kudos