Python Crashes on Call to ListLayers in Data-Driven Pages

3991
5
09-04-2012 02:22 PM
MarcNakleh
New Contributor III
Hello!

I've created a script to crawl through all the MXD's on our server and log in a CSV the workspaces being used by each MXD.
The script seems to work fine; the thing is, certain MXD's seem to cause Python itself to crash. No error messages, or codes, just "Python.exe has stopped working."

After tinkering a bit, I found that it seems to be my call to ListLayers that kills everything.
The relevant bit of code is here:

mxd = arcpy.mapping.MapDocument(mxd_file)
wss = [lyr.workspacePath for lyr in arcpy.mapping.ListLayers(mxd)
       if lyr.supports('workspacePath')]


Bizarrely, I can't seem to figure out what's causing Python to crash. The script only seems to fail when it encounters some (but not all) Index Layers for Data Driven Pages...

Even more bizarrely, when the implicated MXD is opened in ArcMap and the script is run in parallel, everything works swimmingly.

Anyone have any clues on what might be going on? I'm using Python 2.6 with an ArcView 10.0 License, SP4. Windows 7, SP 1 64bit.

Thanks a bunch!
Tags (2)
0 Kudos
5 Replies
MarcNakleh
New Contributor III
Additional Info: Trying to Set Data Sources in ArcCatalog causes it to crash, with a "ArcGIS Desktop has encountered a serious application error" message.

I can send the MXD in question to anyone interested.
0 Kudos
JeffBarrette
Esri Regular Contributor
Can you send a map package along with scripts to jbarrette@esri.com

Thanks,
Jeff
0 Kudos
MarcNakleh
New Contributor III
Hi Jeff,

Much obliged! Just sent you the script and the Map Package.
0 Kudos
JeffBarrette
Esri Regular Contributor
I did not get the file.  I checked my junk folder, etc.  Please check the email: jbarrette@esri.com

Thanks,
Jeff
0 Kudos
AlbertoNieto2
New Contributor II

Marc and Jeff,

I recently started experiencing the same issue with a script. By any chance did you find resolution to your issue?

Thanks,

Alberto

0 Kudos