where to put setprogressor

707
1
04-09-2012 03:17 AM
kyleturner
New Contributor III
Where do I put my setprogressor statements to get a realistic progress bar?

I initially thought it should be in the outermost loop, but now I'm not sure.

Right now I have something to the effect of:

try:
    for ds in DSs:
       listFCs = gp.ListFeatureClasses("","",ds)
       fcCount = len(listFCs)
       gp.SetProgressor("step", "Listing Feature Classes...", 0, fcCount, 1)
       for fcs in listFCs:
           gp.SetProgressorLabel("Calculating fields for... " + fcs)
           gp.SetProgressorPosition()
           do stuff

           then a bunch of other imbedded if/thens and for in within the above for in statement

except:
 your typical messages

finally:
gp.resetprogressor()

  
(Hopefully the above "code" makes sense/is useful.)

Thanks in advance for your help.

Cheers.
Tags (2)
0 Kudos
1 Reply
PhilMorefield
Occasional Contributor III
It should be "gp.ResetProgressor()", and I don't know that calling it in a Finally clause is really necessary. The script is finished at that point.

Other than that, everything looks normal to me. What's the problem you're having?
0 Kudos