Re: uuDecode problem

2005-12-09 Thread Alex Martelli
py <[EMAIL PROTECTED]> wrote: > Thanks...I think base64 will work just fine...and doesnt seem to have > 45 byte limitations, etc. Sure, base64 is a better encoding by all criteria, unless you specifically need to use uu encoding for compatibility with other old software. Alex -- http://mail.py

Re: uuDecode problem

2005-12-09 Thread py
Thanks...I think base64 will work just fine...and doesnt seem to have 45 byte limitations, etc. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: uuDecode problem

2005-12-09 Thread Alex Martelli
py <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > I suggest a redesign...! > > > What would you suggest? I have to encode/decode in chunks b/c of the > 45 byte limitation. Not quite: >>> s=45*'v' >>> a=binascii.b2a_uu(s) >>> len(a) 62 >>> b=binascii.a2b_uu(a) >>> len(b) 45 >>> b==s True

Re: uuDecode problem

2005-12-09 Thread Fredrik Lundh
"py" wrote: > What would you suggest? I have to encode/decode in chunks b/c of the > 45 byte limitation. so use 45-byte chunks, instead of one-byte chunks. but why are you using UU encoding in a nonstandard way ? why not just use the "uu" module to do the chunking for you? the third example o

Re: uuDecode problem

2005-12-09 Thread py
Alex Martelli wrote: I suggest a redesign...! What would you suggest? I have to encode/decode in chunks b/c of the 45 byte limitation. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: uuDecode problem

2005-12-07 Thread Alex Martelli
py <[EMAIL PROTECTED]> wrote: ... > """data is a string""" > if len(data) > 45: > tmp = [] > for c in data: > tmp.append(binascii.b2a_uu(c)) You can't decode b2a-encoded data character by character, blindly, as you're trying to to here. Each character in the

Re: uuDecode problem

2005-12-07 Thread jepler
Note that you can use the 'uu' encoding, which will handle arbitrary-length input and give multi-line uuencoded output, including the 'begin' and 'end' lines: >>> print ("\377" * 120).encode("uu") begin 666 M M

Re: uuDecode problem

2005-12-07 Thread py
Alex Martelli wrote: > binascii.b2a_uu only works for up to 45 bytes at once; but if you were > feeding it more than 45 bytes, this should raise a binascii.Error > itself. > Definitely not, given the above limit. But I still don't quite > understand the exact mechanics of the error you're getting.

Re: uuDecode problem

2005-12-07 Thread Alex Martelli
py <[EMAIL PROTECTED]> wrote: ... > encoded.append(binascii.b2a_uu(stringToEncode)) binascii.b2a_uu only works for up to 45 bytes at once; but if you were feeding it more than 45 bytes, this should raise a binascii.Error itself. > ..any idea why this is happening? Anyone successfully use

uuDecode problem

2005-12-07 Thread py
Hi, I am encoding a string such as... [code] data = someFile.readlines() encoded = [] for line in data: encoded.append(binascii.b2a_uu(stringToEncode)) return encoded [/code] ...I then try to decode this by... [code] def decode(data): result = [] for val in data: result.app