uuDecode problem

py codecraig at gmail.com
Wed Dec 7 09:38:38 EST 2005


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.append(binascii.a2b_uu(val))
    return result
[/code]

this seems to work sometimes....for example a list which has a short
string in it like ["this is a test"]

however if the list of data going into the decode function contains a
bunch of elements I get the following error...

    result.append(binascii.a2b_uu(val))
binascii.Error: Trailing garbage

..any idea why this is happening?  Anyone successfully use the uu to
encode/decode strings of varying length (even larger strings, more than
a few hundred characters)?




More information about the Python-list mailing list