Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / module-uu.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="module-xdrlib.html" />
13<link rel="prev" href="module-quopri.html" />
14<link rel="parent" href="netdata.html" />
15<link rel="next" href="module-xdrlib.html" />
16<meta name='aesop' content='information' />
17<title>12.16 uu -- Encode and decode uuencode files</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="12.15 quopri "
25 href="module-quopri.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="12. Internet Data Handling"
28 href="netdata.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="12.17 xdrlib "
31 href="module-xdrlib.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="module-quopri.html">12.15 quopri </A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="module-xdrlib.html">12.17 xdrlib </A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION00141600000000000000000">
5612.16 <tt class="module">uu</tt> --
57 Encode and decode uuencode files</A>
58</H1>
59
60<P>
61<A NAME="module-uu"></A>
62
63<P>
64This module encodes and decodes files in uuencode format, allowing
65arbitrary binary data to be transferred over ASCII-only connections.
66Wherever a file argument is expected, the methods accept a file-like
67object. For backwards compatibility, a string containing a pathname
68is also accepted, and the corresponding file will be opened for
69reading and writing; the pathname <code>'-'</code> is understood to mean the
70standard input or output. However, this interface is deprecated; it's
71better for the caller to open the file itself, and be sure that, when
72required, the mode is <code>'rb'</code> or <code>'wb'</code> on Windows.
73
74<P>
75This code was contributed by Lance Ellinghouse, and modified by Jack
76Jansen.
77<a id='l2h-4160' xml:id='l2h-4160'></a>
78
79<P>
80The <tt class="module">uu</tt> module defines the following functions:
81
82<P>
83<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
84 <td><nobr><b><tt id='l2h-4157' xml:id='l2h-4157' class="function">encode</tt></b>(</nobr></td>
85 <td><var>in_file, out_file</var><big>[</big><var>, name</var><big>[</big><var>, mode</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
86<dd>
87 Uuencode file <var>in_file</var> into file <var>out_file</var>. The uuencoded
88 file will have the header specifying <var>name</var> and <var>mode</var> as
89 the defaults for the results of decoding the file. The default
90 defaults are taken from <var>in_file</var>, or <code>'-'</code> and <code>0666</code>
91 respectively.
92</dl>
93
94<P>
95<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
96 <td><nobr><b><tt id='l2h-4158' xml:id='l2h-4158' class="function">decode</tt></b>(</nobr></td>
97 <td><var>in_file</var><big>[</big><var>, out_file</var><big>[</big><var>, mode</var><big>[</big><var>, quiet</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
98<dd>
99 This call decodes uuencoded file <var>in_file</var> placing the result on
100 file <var>out_file</var>. If <var>out_file</var> is a pathname, <var>mode</var> is
101 used to set the permission bits if the file must be
102 created. Defaults for <var>out_file</var> and <var>mode</var> are taken from
103 the uuencode header. However, if the file specified in the header
104 already exists, a <tt class="exception">uu.Error</tt> is raised.
105
106<P>
107<tt class="function">decode()</tt> may print a warning to standard error if the
108 input was produced by an incorrect uuencoder and Python could
109 recover from that error. Setting <var>quiet</var> to a true value
110 silences this warning.
111</dl>
112
113<P>
114<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
115 <td><nobr><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-4159' xml:id='l2h-4159' class="exception">Error</tt></b>(</nobr></td>
116 <td><var></var>)</td></tr></table></dt>
117<dd>
118 Subclass of <tt class="exception">Exception</tt>, this can be raised by
119 <tt class="function">uu.decode()</tt> under various situations, such as described
120 above, but also including a badly formatted header, or truncated
121 input file.
122</dl>
123
124<P>
125<div class="seealso">
126 <p class="heading">See Also:</p>
127
128 <dl compact="compact" class="seemodule">
129 <dt>Module <b><tt class="module"><a href="module-binascii.html">binascii</a></tt>:</b>
130 <dd>Support module containing ASCII-to-binary
131 and binary-to-ASCII conversions.
132 </dl>
133</div>
134
135<DIV CLASS="navigation">
136<div class='online-navigation'>
137<p></p><hr />
138<table align="center" width="100%" cellpadding="0" cellspacing="2">
139<tr>
140<td class='online-navigation'><a rel="prev" title="12.15 quopri "
141 href="module-quopri.html"><img src='../icons/previous.png'
142 border='0' height='32' alt='Previous Page' width='32' /></A></td>
143<td class='online-navigation'><a rel="parent" title="12. Internet Data Handling"
144 href="netdata.html"><img src='../icons/up.png'
145 border='0' height='32' alt='Up One Level' width='32' /></A></td>
146<td class='online-navigation'><a rel="next" title="12.17 xdrlib "
147 href="module-xdrlib.html"><img src='../icons/next.png'
148 border='0' height='32' alt='Next Page' width='32' /></A></td>
149<td align="center" width="100%">Python Library Reference</td>
150<td class='online-navigation'><a rel="contents" title="Table of Contents"
151 href="contents.html"><img src='../icons/contents.png'
152 border='0' height='32' alt='Contents' width='32' /></A></td>
153<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
154 border='0' height='32' alt='Module Index' width='32' /></a></td>
155<td class='online-navigation'><a rel="index" title="Index"
156 href="genindex.html"><img src='../icons/index.png'
157 border='0' height='32' alt='Index' width='32' /></A></td>
158</tr></table>
159<div class='online-navigation'>
160<b class="navlabel">Previous:</b>
161<a class="sectref" rel="prev" href="module-quopri.html">12.15 quopri </A>
162<b class="navlabel">Up:</b>
163<a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A>
164<b class="navlabel">Next:</b>
165<a class="sectref" rel="next" href="module-xdrlib.html">12.17 xdrlib </A>
166</div>
167</div>
168<hr />
169<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
170</DIV>
171<!--End of Navigation Panel-->
172<ADDRESS>
173See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
174</ADDRESS>
175</BODY>
176</HTML>