next up previous contents index
Next: 11.15 Built-in Module binascii Up: 11 Internet and WWW Previous: 11.13.1 notes

11.14 Standard module uu

This module encodes and decodes files in uuencode format, allowing arbitrary binary data to be transferred over ascii-only connections. Whereever a file argument is expected, the methods accept either a pathname ('-' for stdin/stdout) or a file-like object.

Normally you would pass filenames, but there is one case where you have to open the file yourself: if you are on a non-unix platform and your binary file is actually a textfile that you want encoded unix-compatible you will have to open the file yourself as a textfile, so newline conversion is performed.

This code was contributed by Lance Ellinghouse, and modified by Jack Jansen.

The uu module defines the following functions:

encode(in_file, out_file[, name, mode])
Uuencode file in_file into file out_file. The uuencoded file will have the header specifying name and mode as the defaults for the results of decoding the file. The default defaults are taken from in_file, or '-' and 0666 respectively.

decode(in_file[, out_file, mode])
This call decodes uuencoded file in_file placing the result on file out_file. If out_file is a pathname the mode is also set. Defaults for out_file and mode are taken from the uuencode header.



guido@cnri.reston.va.us