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

thompson.marisa at gmail.com thompson.marisa at gmail.com
Wed Dec 20 15:26:35 EST 2006


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.

Thank you all so much.
Marisa


On Dec 20, 2:22 pm, Fredrik Lundh <fred... at pythonware.com> wrote:
> thompson.mar... at gmail.com 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 Python
> > people could help me more.
>
> > I hope there is something simple I could do to be able to define the
> > object that it thinks is NoneType.that would be the None object.
>
>    http://effbot.org/pyref/None
>
> which is often used as a placeholder in Python.
>
> my guess is that it's the next() call that returns None when you've
> reached the end of the shapefile list; try changing
>
>      while Townshps !="":
>
> to
>
>      while Townshps is not None:
>
> and see if the problem goes away.
>
> if you still get an exception, please post the full traceback; see
>
> http://effbot.org/pyfaq/tutor-i-need-help-im-getting-an-error-in-my-p...
> 
> for details.
> 
> </F>




More information about the Python-list mailing list