gcorradini

pythonw.exe crash on arcpy.mapping.ListLayers...faulting module pagelayout.dll?

Discussion created by gcorradini on Mar 4, 2011
Latest reply on Mar 4, 2011 by niklas.norrthonesri-se-esridist
Hello,
I'm trying to understand why pythonw.exe shutdowns/crashes when accessing the line "layers = mm.ListLayers(MXD)" in the callback function to os.path.walk below.

Has anyone experienced this same problem before?

I know it's not corrupt MXDs b/c even if I blow away the MXD it dies on, the thing still dies later. No traceback is thrown to catch.

The Event Error Log in Windows has this to say:
"""
Faulting application pythonw.exe, version 0.0.0.0, stamp 4ba3e4e2, faulting module pagelayout.dll, version 10.0.0.2414, stamp 4bf4488b, debug? 0, fault address 0x0000cc87.
"""
ideas?


#CODE
def mxdLayerHandle(arg, dirname, names):
    for name in names:
        try:
            print "NAME: "+name
            if os.path.isdir(os.path.join(dirname, name)):
                print "TYPE: Directory"
                log.write("DIR:  "+name + "\n")
                search = glob.glob(os.path.join(dirname, name)+"/"+arg)
                for mxd in search:
                    print mxd + "\n"
                    log.write(mxd+"\n")
                    MXD = mm.MapDocument(mxd)
                    layers = mm.ListLayers(MXD)
                    for lyr in layers:
                        print lyr.name
                        try:
                            if str(lyr.dataSource) == mxdSearchTerm:
                                log.write("YES\n")
                        except:
                                continue
            else:
                continue
        except:
            log.write("MXD CORRUPT\n")

Outcomes