Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19725

Re: TypeError

From Nick Dokos <nicholas.dokos@hp.com>
Subject Re: TypeError
References <0610E9FC98B37742AD184612801101F834B04E@x10-mbx4.yu.yale.edu>
Organization HPCS
Date 2012-02-01 12:27 -0500
Newsgroups comp.lang.python
Message-ID <mailman.5309.1328117762.27778.python-list@python.org> (permalink)

Show all headers | View raw


Clark, Kathleen <katie.clark@yale.edu> wrote:



> TypeError: sequence item 1: expected string, NoneType found
> 
> The error message is referencing line 86 of my code:
> 
> ws.cell(row=row, column=1).value = ','.join([str(ino), fn, ln, sdob])
> 
> If I’m understanding this correctly, the code is expecting a string, but not finding it.  I’m
> wondering, what is meant by a “string” and also how I can figure out the problem and correct it. 

I'd guess that the sequence in question is the list that's the argument
of join(), in which case item 1 is fn: it should be a string but for some
reason, it is a None value:

,----
| >>> ','.join([str(45), None, "bar", "foo"])
| Traceback (most recent call last):
|   File "<stdin>", line 1, in <module>
| TypeError: sequence item 1: expected string, NoneType found
|>>> ','.join([str(45), "a string", "bar", "foo"])
|'45,a string,bar,foo'
`----

Nick

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: TypeError Nick Dokos <nicholas.dokos@hp.com> - 2012-02-01 12:27 -0500

csiph-web