c_blandy

Getting Alias Field names from layer in mxd 10.0 SP5 not working

Discussion created by c_blandy on Dec 9, 2013
Latest reply on Dec 18, 2013 by Wayne_Whitley
I am trying get the field aliases for each of the layers in an mxd document.  I have the following snippet that should do the trick.
import arcpy
from arcpy import env
import os, zipfile, zlib, shutil

mxd = arcpy.mapping.MapDocument(r"C:\\temp\OpenData\OpenData_test.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
  desc = arcpy.Describe(lyr)
  for field in desc.fields:
    print field.name, ":", field.aliasName, ":", field.type, ":", field.length, ":", field.domain
del mxd


When this code is run in stand-alone mode the describe gives an error (this is bug at 10.0 SPx apparently). When I run it through python in ArcMap using:
mxd = arcpy.mapping.MapDocument("CURRENT")
the program runs but the alias field names are not listed. I have spent a lot time trying to figure it out but based on my searches it seems that the issue lies with 10.0 SPx.

Can anybody confirm this or, alternatively, give some suggestions on ways I can get the alias field names for each layer in an mxd?

Outcomes