This commit was manufactured by cvs2svn to create tag 'r221c2'.
[python/dscho.git] / Doc / lib / libuu.tex
blobe938c4faebd64677dd21a33dde7796288d317aab
1 \section{\module{uu} ---
2 Encode and decode uuencode files}
4 \declaremodule{standard}{uu}
5 \modulesynopsis{Encode and decode files in uuencode format.}
6 \moduleauthor{Lance Ellinghouse}{}
9 This module encodes and decodes files in uuencode format, allowing
10 arbitrary binary data to be transferred over ASCII-only connections.
11 Wherever a file argument is expected, the methods accept a file-like
12 object. For backwards compatibility, a string containing a pathname
13 is also accepted, and the corresponding file will be opened for
14 reading and writing; the pathname \code{'-'} is understood to mean the
15 standard input or output. However, this interface is deprecated; it's
16 better for the caller to open the file itself, and be sure that, when
17 required, the mode is \code{'rb'} or \code{'wb'} on Windows or DOS.
19 This code was contributed by Lance Ellinghouse, and modified by Jack
20 Jansen.
21 \index{Jansen, Jack}
22 \index{Ellinghouse, Lance}
24 The \module{uu} module defines the following functions:
26 \begin{funcdesc}{encode}{in_file, out_file\optional{, name\optional{, mode}}}
27 Uuencode file \var{in_file} into file \var{out_file}. The uuencoded
28 file will have the header specifying \var{name} and \var{mode} as
29 the defaults for the results of decoding the file. The default
30 defaults are taken from \var{in_file}, or \code{'-'} and \code{0666}
31 respectively.
32 \end{funcdesc}
34 \begin{funcdesc}{decode}{in_file\optional{, out_file\optional{, mode}}}
35 This call decodes uuencoded file \var{in_file} placing the result on
36 file \var{out_file}. If \var{out_file} is a pathname, \var{mode} is
37 used to set the permission bits if the file must be
38 created. Defaults for \var{out_file} and \var{mode} are taken from
39 the uuencode header. However, if the file specified in the header
40 already exists, a \exception{uu.Error} is raised.
41 \end{funcdesc}
43 \begin{excclassdesc}{Error}{}
44 Subclass of \exception{Exception}, this can be raised by
45 \function{uu.decode()} under various situations, such as described
46 above, but also including a badly formated header, or truncated
47 input file.
48 \end{excclassdesc}
50 \begin{seealso}
51 \seemodule{binascii}{Support module containing \ASCII-to-binary
52 and binary-to-\ASCII{} conversions.}
53 \end{seealso}