source: trunk/essentials/dev-lang/python/Doc/lib/libuu.tex

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 2.4 KB
Line 
1\section{\module{uu} ---
2 Encode and decode uuencode files}
3
4\declaremodule{standard}{uu}
5\modulesynopsis{Encode and decode files in uuencode format.}
6\moduleauthor{Lance Ellinghouse}{}
7
8
9This module encodes and decodes files in uuencode format, allowing
10arbitrary binary data to be transferred over ASCII-only connections.
11Wherever a file argument is expected, the methods accept a file-like
12object. For backwards compatibility, a string containing a pathname
13is also accepted, and the corresponding file will be opened for
14reading and writing; the pathname \code{'-'} is understood to mean the
15standard input or output. However, this interface is deprecated; it's
16better for the caller to open the file itself, and be sure that, when
17required, the mode is \code{'rb'} or \code{'wb'} on Windows.
18
19This code was contributed by Lance Ellinghouse, and modified by Jack
20Jansen.
21\index{Jansen, Jack}
22\index{Ellinghouse, Lance}
23
24The \module{uu} module defines the following functions:
25
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}
33
34\begin{funcdesc}{decode}{in_file\optional{, out_file\optional{, mode\optional{, quiet}}}}
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
42 \function{decode()} may print a warning to standard error if the
43 input was produced by an incorrect uuencoder and Python could
44 recover from that error. Setting \var{quiet} to a true value
45 silences this warning.
46\end{funcdesc}
47
48\begin{excclassdesc}{Error}{}
49 Subclass of \exception{Exception}, this can be raised by
50 \function{uu.decode()} under various situations, such as described
51 above, but also including a badly formatted header, or truncated
52 input file.
53\end{excclassdesc}
54
55\begin{seealso}
56 \seemodule{binascii}{Support module containing \ASCII-to-binary
57 and binary-to-\ASCII{} conversions.}
58\end{seealso}
Note: See TracBrowser for help on using the repository browser.