Q. on a TypeError.

Fredrik Lundh effbot at telia.com
Mon Mar 13 14:12:57 EST 2000


Wayne <infotechsys at pivot.net> wrote:
> I'm using Python 1.5.2 on a Linux system.
> I wrote a little program to format a printed report. I'm get an error
> which I don't understand
> why I'm getting it.
>
> The line of code in question is:
>     nbr_of_spaces = blk_sz_value - len(entry['fld_value'])
>
>      TypeError: len() of unsize object
>
>   The value that is in question is a date and there is a value in the
> dictionary.

the exception is telling you that you're trying to take the
length of something that isn't a sequence.

adding a few print statements before the offending line
should help you figure out what's wrong:

print repr(entry['fld_value'])
print type(entry['fld_value'])

</F>





More information about the Python-list mailing list