Determine size of string in bytes
John Machin
sjmachin at lexicon.net
Thu Mar 27 17:10:03 EDT 2008
On Mar 28, 6:45 am, breal <hacker.steven... at gmail.com> wrote:
> Forgive me for this question which is most likely stupid...
The contents of your question are not stupid. The subject however does
invite a stupid answer like: len(the_string).
Disclaimer: I know nothing about SOAP except that it's usually
capitalised :-) Now read on:
> How do I determine the number of bytes a string takes up? I have a
> soap server that is returning a serialized string.
Serialised how? UTF-8?
> It seems that when
> the string goes over 65978 characters it does not return to the soap
> client.
Why does it seem so? How did you arrive at such a precise limit?
> Instead I get an error:
> error: (35, 'Resource temporarily unavailable')
Is this error from the client or the server? Any error or logfile
record from the other side?
Is there anything in the documentation about maximum sizes?
>
> This makes me think the problem exists on the soap client side with
> some sort of max return length.
Think? Can't you verify this by inspecting the source?
> If I knew how many bytes the 65978
> character string was, then I could try to up this value.
How do you know the string is 65978 characters? If you are debugging
the server, can't you do len(serialise(the_65978_char_string))?
65978? Are you sure? Looks suspiciously close to 65535 aka 0xFFFF aka
(2 ** 16 - 1 ) to me.
If you have the server, you presumably have the source code for both
client and server. Some options for you:
(1) Look at the traceback(s), look at the source code, nut it out for
yourself. If there is some kind of max other than an implicit 16-bit
limitation in the client code, it shouldn't be too hard to find.
(2) Post the traceback(s) here, along with other details that might be
useful, like what SOAP server s/w you are using, what version of
Python, what platform.
HTH,
John
More information about the Python-list
mailing list