Help?? Struct packing of Date time not has stopped working??!?!

Klaus Baldermann kbaldermann at entire-systems.com
Wed Dec 15 08:30:14 EST 1999


quickbbs at my-deja.com wrote in message <835mvi$62t$1 at nnrp1.deja.com>...

>In other words, the client attachs, and reports: "struct.err: str size
>does not match format".

One of my first Python exercises was a (rdate) client.
It had the problem that the read_all() sometimes
returned less than 4 characters.
This happened only intermittently, so I simply
put a loop around the thing:

line = ""
while len(line) != 4:
    connection.open(host, 37)
    line = connection.read_all()
    connection.close

Of course, this is most inelegant solution (might even take looong),
and I still don't know what the reason was/is. I thought about nulls '\0',
but now I think it might have to do with newlines. What will telnetlib's
read_all()
return if the data is containing newlines? Will it return a string with
embedded \n's
or a list of strings, like a file's readlines() method?

yours
Klaus






More information about the Python-list mailing list