Hi.
I'm extremely new to Python and programming as a whole. I have written
a python script with the assistance of ESRI ArcGIS 9.2, which uses
Python 2.4.1, however, it gives me this error when I try to run it.
I've already posted at ESRI support, and I was hoping that Python
people could help me
[EMAIL PROTECTED] wrote:
> I'm extremely new to Python and programming as a whole. I have written
> a python script with the assistance of ESRI ArcGIS 9.2, which uses
> Python 2.4.1, however, it gives me this error when I try to run it.
> I've already posted at ESRI support, and I was hoping that
> # Begin going through the loop
> Townshp = Townshps.next()
> while Townshps !="":
> #Set the output name to be the same as input
> outName = outputPath + "/" + Townshp + "land" + ".img"
> Output_table = outputPath + "/" + Townshp + "table" + ".dbf"
> #For each extract by Mask
>
On Wed, 2006-12-20 at 20:22 +0100, Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > I'm extremely new to Python and programming as a whole. I have written
> > a python script with the assistance of ESRI ArcGIS 9.2, which uses
> > Python 2.4.1, however, it gives me this error when I try to ru
Fredrik Lundh wrote:
> while Townshps is not None:
or rather,
while Townshp is not None:
since that's the variable you're using later on.
--
http://mail.python.org/mailman/listinfo/python-list
Mark Peters wrote:
> However, the typical Python way to iterate through a list for be to
> use a for loop. Perhaps replace the while statement with:
> for Townshp in Townshps:
> and remove the "Townshp = Townshps.next()" lines
that assumes that the feature class list is actually a Python iterab
[EMAIL PROTECTED] a écrit :
> Hi.
>
> I'm extremely new to Python and programming as a whole. I have written
> a python script with the assistance of ESRI ArcGIS 9.2, which uses
> Python 2.4.1, however, it gives me this error when I try to run it.
Please post the full traceback. It's meant to he
Bruno Desthuilliers a écrit :
> [EMAIL PROTECTED] a écrit :
>
> 4/ the Python 'for' loop is meant to iterate over an iterable and taking
> care of boundaries, so you'd be better using it:
>
> townships = gp.ListFeatureClasses ("*")
> for township in townships:
> doSomethingWith(township)
Actu
I've had a lot of replies suggesting different things. These are the
results:
When I change
while Townshps !="": to
while Townshp is not None:
and when I change
while Townshps !="": to
for Townshp in iter(gp.ListFeatureClasses().next, None):
They both work perfectly, and it solved my problem.
On Wed, 2006-12-20 at 11:33 -0800, Mark Peters wrote:
> Warning: I know nothing about the Python ArcGIS stuff.
>
> The first thing that jumps out at me is your while condition. You are
> testing "Townshps" when it seems from the code that you should be
> testing "Townshp". However, the typical P
10 matches
Mail list logo