POST
|
Thank you for the suggestions. Unfortunately in this case I only run the code on one specific mxd which has the necessary group layers, and I am not running in model builder, but rather in the python window. (because this isn't a distributed code, I'm not worried about someone using it with another mxd)
... View more
03-25-2013
06:51 AM
|
0
|
0
|
269
|
POST
|
Yes I am: mxd = arcpy.mapping.MapDocument("CURRENT")
... View more
03-20-2013
02:40 PM
|
0
|
0
|
269
|
POST
|
I've created a python script that manipulates a page layout so that I can export the view to a PDF. The code uses several different ""Select By Attribute" methods. My code operates as a function in a module I import into the arcpy window. After executing the function a number of times (variable number - say between 5 and 20) the following error is returned [ATTACH=CONFIG]22815[/ATTACH] Runtime error <class 'arcgisscripting.ExecuteError'>: ERROR 000582: Error occurred during execution. The code section that causes the error is:
##Highlight correct SU in extent window
df = arcpy.mapping.ListDataFrames(mxd, "Legend and Extent Rectangle")[0]
for lyr in arcpy.mapping.ListLayers(mxd, bldg, df):
for sublyr in lyr:
if sublyr.name == s:
sublyr.visible = True
arcpy.SelectLayerByAttribute_management(sublyr, "NEW_SELECTION", "[SU] = %d" % (SU))
else:
sublyr.visible = False
Under geoprocessing options, I turned OFF background processing because simple selection like the one above take FOREVER with background processing turned on. (Side question - why must the map refresh after every selection? Can I supress that??) I noticed however that if I turn background processing ON, I can run my code again without a problem. Does anyone have an idea what is causing this problem, and why it might be so seemingly random?
... View more
03-20-2013
02:21 PM
|
0
|
4
|
826
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|