1:mod:`uu` --- Encode and decode uuencode files
2==============================================
3
4.. module:: uu
5   :synopsis: Encode and decode files in uuencode format.
6   :deprecated:
7
8.. moduleauthor:: Lance Ellinghouse
9
10**Source code:** :source:`Lib/uu.py`
11
12.. deprecated-removed:: 3.11 3.13
13   The :mod:`uu` module is deprecated
14   (see :pep:`PEP 594 <594#uu-and-the-uu-encoding>` for details).
15   :mod:`base64` is a modern alternative.
16
17--------------
18
19This module encodes and decodes files in uuencode format, allowing arbitrary
20binary data to be transferred over ASCII-only connections. Wherever a file
21argument is expected, the methods accept a file-like object.  For backwards
22compatibility, a string containing a pathname is also accepted, and the
23corresponding file will be opened for reading and writing; the pathname ``'-'``
24is understood to mean the standard input or output.  However, this interface is
25deprecated; it's better for the caller to open the file itself, and be sure
26that, when required, the mode is ``'rb'`` or ``'wb'`` on Windows.
27
28.. index::
29   single: Jansen, Jack
30   single: Ellinghouse, Lance
31
32This code was contributed by Lance Ellinghouse, and modified by Jack Jansen.
33
34The :mod:`uu` module defines the following functions:
35
36
37.. function:: encode(in_file, out_file, name=None, mode=None, *, backtick=False)
38
39   Uuencode file *in_file* into file *out_file*.  The uuencoded file will have
40   the header specifying *name* and *mode* as the defaults for the results of
41   decoding the file. The default defaults are taken from *in_file*, or ``'-'``
42   and ``0o666`` respectively.  If *backtick* is true, zeros are represented by
43   ``'`'`` instead of spaces.
44
45   .. versionchanged:: 3.7
46      Added the *backtick* parameter.
47
48
49.. function:: decode(in_file, out_file=None, mode=None, quiet=False)
50
51   This call decodes uuencoded file *in_file* placing the result on file
52   *out_file*. If *out_file* is a pathname, *mode* is used to set the permission
53   bits if the file must be created. Defaults for *out_file* and *mode* are taken
54   from the uuencode header.  However, if the file specified in the header already
55   exists, a :exc:`uu.Error` is raised.
56
57   :func:`decode` may print a warning to standard error if the input was produced
58   by an incorrect uuencoder and Python could recover from that error.  Setting
59   *quiet* to a true value silences this warning.
60
61
62.. exception:: Error()
63
64   Subclass of :exc:`Exception`, this can be raised by :func:`uu.decode` under
65   various situations, such as described above, but also including a badly
66   formatted header, or truncated input file.
67
68
69.. seealso::
70
71   Module :mod:`binascii`
72      Support module containing ASCII-to-binary and binary-to-ASCII conversions.
73