Python uu decode method














































Python uu decode method



Python uu decode method

This module decode the encoded data into actual file i.e. convert plain text into arbitary binary data.

Description

decode(in_file, out_file=None, mode=None, quiet=False)

This method decodes encoded data taken as file in_file and after decoding place it to the result on file out_file as output. If out_file has a pathname, mode can be used to set the permission bits for the file to be created. If not specify defaults for out_file and mode are taken from the uuencode header. However, if the file in the header already exists, a uu.Error is raised.

note:

decode() may print a warning to standard error if the input was produced by an incorrect uuencoder and Python could recover from that error. Setting 'quiet' to a true value silences this warning.


Example

import uu
import StringIO
infile = "sample1.uue"

fi = open(infile)
fo = StringIO.StringIO()

uu.decode(fi, fo)

Comments