TypeError

Nick Dokos nicholas.dokos at hp.com
Wed Feb 1 18:27:47 CET 2012


Clark, Kathleen <katie.clark at 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




More information about the Python-list mailing list