TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread thompson . marisa
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

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Fredrik Lundh
[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

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Mark Peters
> # 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 >

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Carsten Haese
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

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Fredrik Lundh
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

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Fredrik Lundh
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

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Bruno Desthuilliers
[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

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Bruno Desthuilliers
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

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread thompson . marisa
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.

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Carsten Haese
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