What is the value of descr when it raises that exception? Try printing
descr (or repr(descr)) to find out.
BTW, len() always returns an int, so "len(descr) is not None" is always
true.
I can only guess that the fetchone() method you're referring to is a
method on sqlite3.Cursor. If so, the docs I've got say:
>>>Fetches the next row of a query result set, returning a single
sequence, or None <constants.html#None> when no more data is available.
Of course None doesn't have a length, as it's not a collection, nor
equivalent to one. There's another thing wrong with your if-test.
len() returns an integer, so it'll never be equal to None. Presumably
you're trying to check for an empty sequence.
So your if test would need to be something like:
if descr is not None and len(descr) > 0:
This could be simplified, but I'd rather be explicit. But just for
completeness, I believe the following would work as well:
if descr:
DaveA
DaveA