AnsweredAssumed Answered

Python script cannot execute in python window

Question asked by jzkyip on Apr 7, 2016
Latest reply on Apr 8, 2016 by jzkyip

I have been using a python code to automate some mapping by loading the python script onto the GIS (10.2) python window and pressing Return to get it to start running. It has been working but for some reason the next time I loaded the code into the python window and pressed Return, instead of the code running, it went straight back to a command prompt. I cannot figure what has changed for this code to no longer get executed. Please help! Any suggestions would be very very helpful!

import arcpy
import numpy as np
mxd = arcpy.mapping.MapDocument("Current")
lstDataFrames=arcpy.mapping.ListDataFrames(mxd)
varLyrs = arcpy.mapping.ListLayers(mxd,'_Wt_norm*')
var_list = np.arange(0,16)
for ilyr in varLyrs:
    var_n = ilyr.name[:2].upper()
    
    for i in var_list:
        outpath = r"F://GIS_Data//SOM//Results_12Var4by4//Maps//" + var_n + "_N" + i + "_Norm.jpg"
        arcpy.ApplySymbologyFromLayer_management(ilyr, r"F://GIS_Data//Arcpy//SOM_Norm_Default.lyr")
        ilyr.symbology.valueField = "N" + str(i)
        ilyr.visible = True
        arcpy.mapping.ExportToJPEG(mxd, outpath)
        print("Node ", i)
        ilyr.visible = False

Outcomes