Select to view content in your preferred language

Why differences in Field Mapping strings Python 2.7 vs 3?

589
0
09-16-2020 03:07 PM
DarylHochhalter
Frequent Contributor

While trying to run a script I've used in python 2.7 for some time, I encountered real issues with the field mappings when trying to run it using python 3. Python 2.7 seemed more forgiving in the format of a field mapping variable for use with FeatureClassToFeatureClass_conversion(). I was able to change the string representation in several ways, including using the string rather then loading it into a FieldMappings() object. I've attached 2 examples of how the string for field mapping had to be formatted very differently to work in either python 2.7 or 3. I'm really not sure if this might not be a bug in arcpy for python 3, but I do know that the string format for field mappings used with FeatureClassToFeatureClass in python 2.7 is way more forgiving then what it had to be for python 3.

0 Kudos
0 Replies