~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.12-docs-html/library/macostools.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
 
 
5
<html xmlns="http://www.w3.org/1999/xhtml">
 
6
  <head>
 
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
8
    
 
9
    <title>37.3. macostools — Convenience routines for file manipulation &mdash; Python 2.7.12 documentation</title>
 
10
    
 
11
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
 
12
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
13
    
 
14
    <script type="text/javascript">
 
15
      var DOCUMENTATION_OPTIONS = {
 
16
        URL_ROOT:    '../',
 
17
        VERSION:     '2.7.12',
 
18
        COLLAPSE_INDEX: false,
 
19
        FILE_SUFFIX: '.html',
 
20
        HAS_SOURCE:  true
 
21
      };
 
22
    </script>
 
23
    <script type="text/javascript" src="../_static/jquery.js"></script>
 
24
    <script type="text/javascript" src="../_static/underscore.js"></script>
 
25
    <script type="text/javascript" src="../_static/doctools.js"></script>
 
26
    <script type="text/javascript" src="../_static/sidebar.js"></script>
 
27
    <link rel="search" type="application/opensearchdescription+xml"
 
28
          title="Search within Python 2.7.12 documentation"
 
29
          href="../_static/opensearch.xml"/>
 
30
    <link rel="author" title="About these documents" href="../about.html" />
 
31
    <link rel="copyright" title="Copyright" href="../copyright.html" />
 
32
    <link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
 
33
    <link rel="up" title="37. Mac OS X specific services" href="mac.html" />
 
34
    <link rel="next" title="37.5. EasyDialogs — Basic Macintosh dialogs" href="easydialogs.html" />
 
35
    <link rel="prev" title="37.2. MacOS — Access to Mac OS interpreter features" href="macos.html" />
 
36
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 
37
    <script type="text/javascript" src="../_static/copybutton.js"></script>
 
38
    <script type="text/javascript" src="../_static/version_switch.js"></script>
 
39
 
 
40
    
 
41
 
 
42
  </head>
 
43
  <body role="document">  
 
44
    <div class="related" role="navigation" aria-label="related navigation">
 
45
      <h3>Navigation</h3>
 
46
      <ul>
 
47
        <li class="right" style="margin-right: 10px">
 
48
          <a href="../genindex.html" title="General Index"
 
49
             accesskey="I">index</a></li>
 
50
        <li class="right" >
 
51
          <a href="../py-modindex.html" title="Python Module Index"
 
52
             >modules</a> |</li>
 
53
        <li class="right" >
 
54
          <a href="easydialogs.html" title="37.5. EasyDialogs — Basic Macintosh dialogs"
 
55
             accesskey="N">next</a> |</li>
 
56
        <li class="right" >
 
57
          <a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
 
58
             accesskey="P">previous</a> |</li>
 
59
        <li><img src="../_static/py.png" alt=""
 
60
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
61
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
62
        <li>
 
63
          <span class="version_switcher_placeholder">2.7.12</span>
 
64
          <a href="../index.html">Documentation</a> &raquo;
 
65
        </li>
 
66
 
 
67
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
68
          <li class="nav-item nav-item-2"><a href="mac.html" accesskey="U">37. Mac OS X specific services</a> &raquo;</li> 
 
69
      </ul>
 
70
    </div>    
 
71
 
 
72
    <div class="document">
 
73
      <div class="documentwrapper">
 
74
        <div class="bodywrapper">
 
75
          <div class="body" role="main">
 
76
            
 
77
  <div class="section" id="module-macostools">
 
78
<span id="macostools-convenience-routines-for-file-manipulation"></span><h1>37.3. <a class="reference internal" href="#module-macostools" title="macostools: Convenience routines for file manipulation. (deprecated) (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">macostools</span></code></a> &#8212; Convenience routines for file manipulation<a class="headerlink" href="#module-macostools" title="Permalink to this headline">¶</a></h1>
 
79
<p>This module contains some convenience routines for file-manipulation on the
 
80
Macintosh. All file parameters can be specified as pathnames, <code class="xref py py-class docutils literal"><span class="pre">FSRef</span></code> or
 
81
<code class="xref py py-class docutils literal"><span class="pre">FSSpec</span></code> objects.  This module expects a filesystem which supports forked
 
82
files, so it should not be used on UFS partitions.</p>
 
83
<div class="admonition note">
 
84
<p class="first admonition-title">Note</p>
 
85
<p class="last">This module has been removed in Python 3.</p>
 
86
</div>
 
87
<p>The <a class="reference internal" href="#module-macostools" title="macostools: Convenience routines for file manipulation. (deprecated) (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">macostools</span></code></a> module defines the following functions:</p>
 
88
<dl class="function">
 
89
<dt id="macostools.copy">
 
90
<code class="descclassname">macostools.</code><code class="descname">copy</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>createpath</em><span class="optional">[</span>, <em>copytimes</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#macostools.copy" title="Permalink to this definition">¶</a></dt>
 
91
<dd><p>Copy file <em>src</em> to <em>dst</em>.  If <em>createpath</em> is non-zero the folders leading to
 
92
<em>dst</em> are created if necessary. The method copies data and resource fork and
 
93
some finder information (creator, type, flags) and optionally the creation,
 
94
modification and backup times (default is to copy them). Custom icons, comments
 
95
and icon position are not copied.</p>
 
96
<div class="admonition note">
 
97
<p class="first admonition-title">Note</p>
 
98
<p class="last">This function does not work in 64-bit code because it uses APIs that
 
99
are not available in 64-bit mode.</p>
 
100
</div>
 
101
</dd></dl>
 
102
 
 
103
<dl class="function">
 
104
<dt id="macostools.copytree">
 
105
<code class="descclassname">macostools.</code><code class="descname">copytree</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#macostools.copytree" title="Permalink to this definition">¶</a></dt>
 
106
<dd><p>Recursively copy a file tree from <em>src</em> to <em>dst</em>, creating folders as needed.
 
107
<em>src</em> and <em>dst</em> should be specified as pathnames.</p>
 
108
<div class="admonition note">
 
109
<p class="first admonition-title">Note</p>
 
110
<p class="last">This function does not work in 64-bit code because it uses APIs that
 
111
are not available in 64-bit mode.</p>
 
112
</div>
 
113
</dd></dl>
 
114
 
 
115
<dl class="function">
 
116
<dt id="macostools.mkalias">
 
117
<code class="descclassname">macostools.</code><code class="descname">mkalias</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#macostools.mkalias" title="Permalink to this definition">¶</a></dt>
 
118
<dd><p>Create a finder alias <em>dst</em> pointing to <em>src</em>.</p>
 
119
<div class="admonition note">
 
120
<p class="first admonition-title">Note</p>
 
121
<p class="last">This function does not work in 64-bit code because it uses APIs that
 
122
are not available in 64-bit mode.</p>
 
123
</div>
 
124
</dd></dl>
 
125
 
 
126
<dl class="function">
 
127
<dt id="macostools.touched">
 
128
<code class="descclassname">macostools.</code><code class="descname">touched</code><span class="sig-paren">(</span><em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#macostools.touched" title="Permalink to this definition">¶</a></dt>
 
129
<dd><p>Tell the finder that some bits of finder-information such as creator or type for
 
130
file <em>dst</em> has changed. The file can be specified by pathname or fsspec. This
 
131
call should tell the finder to redraw the files icon.</p>
 
132
<div class="deprecated">
 
133
<p><span class="versionmodified">Deprecated since version 2.6: </span>The function is a no-op on OS X.</p>
 
134
</div>
 
135
</dd></dl>
 
136
 
 
137
<dl class="data">
 
138
<dt id="macostools.BUFSIZ">
 
139
<code class="descclassname">macostools.</code><code class="descname">BUFSIZ</code><a class="headerlink" href="#macostools.BUFSIZ" title="Permalink to this definition">¶</a></dt>
 
140
<dd><p>The buffer size for <code class="docutils literal"><span class="pre">copy</span></code>, default 1 megabyte.</p>
 
141
</dd></dl>
 
142
 
 
143
<p>Note that the process of creating finder aliases is not specified in the Apple
 
144
documentation. Hence, aliases created with <a class="reference internal" href="#macostools.mkalias" title="macostools.mkalias"><code class="xref py py-func docutils literal"><span class="pre">mkalias()</span></code></a> could conceivably
 
145
have incompatible behaviour in some cases.</p>
 
146
</div>
 
147
<div class="section" id="module-findertools">
 
148
<span id="findertools-the-finder-s-apple-events-interface"></span><h1>37.4. <a class="reference internal" href="#module-findertools" title="findertools: Wrappers around the finder's Apple Events interface. (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">findertools</span></code></a> &#8212; The <strong class="program">finder</strong>&#8216;s Apple Events interface<a class="headerlink" href="#module-findertools" title="Permalink to this headline">¶</a></h1>
 
149
<p id="index-0">This module contains routines that give Python programs access to some
 
150
functionality provided by the finder. They are implemented as wrappers around
 
151
the AppleEvent interface to the finder.</p>
 
152
<p>All file and folder parameters can be specified either as full pathnames, or as
 
153
<code class="xref py py-class docutils literal"><span class="pre">FSRef</span></code> or <code class="xref py py-class docutils literal"><span class="pre">FSSpec</span></code> objects.</p>
 
154
<p>The <a class="reference internal" href="#module-findertools" title="findertools: Wrappers around the finder's Apple Events interface. (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">findertools</span></code></a> module defines the following functions:</p>
 
155
<dl class="function">
 
156
<dt id="findertools.launch">
 
157
<code class="descclassname">findertools.</code><code class="descname">launch</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.launch" title="Permalink to this definition">¶</a></dt>
 
158
<dd><p>Tell the finder to launch <em>file</em>. What launching means depends on the file:
 
159
applications are started, folders are opened and documents are opened in the
 
160
correct application.</p>
 
161
</dd></dl>
 
162
 
 
163
<dl class="function">
 
164
<dt id="findertools.Print">
 
165
<code class="descclassname">findertools.</code><code class="descname">Print</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.Print" title="Permalink to this definition">¶</a></dt>
 
166
<dd><p>Tell the finder to print a file. The behaviour is identical to selecting the
 
167
file and using the print command in the finder&#8217;s file menu.</p>
 
168
</dd></dl>
 
169
 
 
170
<dl class="function">
 
171
<dt id="findertools.copy">
 
172
<code class="descclassname">findertools.</code><code class="descname">copy</code><span class="sig-paren">(</span><em>file</em>, <em>destdir</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.copy" title="Permalink to this definition">¶</a></dt>
 
173
<dd><p>Tell the finder to copy a file or folder <em>file</em> to folder <em>destdir</em>. The
 
174
function returns an <code class="xref py py-class docutils literal"><span class="pre">Alias</span></code> object pointing to the new file.</p>
 
175
</dd></dl>
 
176
 
 
177
<dl class="function">
 
178
<dt id="findertools.move">
 
179
<code class="descclassname">findertools.</code><code class="descname">move</code><span class="sig-paren">(</span><em>file</em>, <em>destdir</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.move" title="Permalink to this definition">¶</a></dt>
 
180
<dd><p>Tell the finder to move a file or folder <em>file</em> to folder <em>destdir</em>. The
 
181
function returns an <code class="xref py py-class docutils literal"><span class="pre">Alias</span></code> object pointing to the new file.</p>
 
182
</dd></dl>
 
183
 
 
184
<dl class="function">
 
185
<dt id="findertools.sleep">
 
186
<code class="descclassname">findertools.</code><code class="descname">sleep</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#findertools.sleep" title="Permalink to this definition">¶</a></dt>
 
187
<dd><p>Tell the finder to put the Macintosh to sleep, if your machine supports it.</p>
 
188
</dd></dl>
 
189
 
 
190
<dl class="function">
 
191
<dt id="findertools.restart">
 
192
<code class="descclassname">findertools.</code><code class="descname">restart</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#findertools.restart" title="Permalink to this definition">¶</a></dt>
 
193
<dd><p>Tell the finder to perform an orderly restart of the machine.</p>
 
194
</dd></dl>
 
195
 
 
196
<dl class="function">
 
197
<dt id="findertools.shutdown">
 
198
<code class="descclassname">findertools.</code><code class="descname">shutdown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#findertools.shutdown" title="Permalink to this definition">¶</a></dt>
 
199
<dd><p>Tell the finder to perform an orderly shutdown of the machine.</p>
 
200
</dd></dl>
 
201
 
 
202
</div>
 
203
 
 
204
 
 
205
          </div>
 
206
        </div>
 
207
      </div>
 
208
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
209
        <div class="sphinxsidebarwrapper">
 
210
  <h3><a href="../contents.html">Table Of Contents</a></h3>
 
211
  <ul>
 
212
<li><a class="reference internal" href="#">37.3. <code class="docutils literal"><span class="pre">macostools</span></code> &#8212; Convenience routines for file manipulation</a></li>
 
213
<li><a class="reference internal" href="#module-findertools">37.4. <code class="docutils literal"><span class="pre">findertools</span></code> &#8212; The <strong class="program">finder</strong>&#8216;s Apple Events interface</a></li>
 
214
</ul>
 
215
 
 
216
  <h4>Previous topic</h4>
 
217
  <p class="topless"><a href="macos.html"
 
218
                        title="previous chapter">37.2. <code class="docutils literal"><span class="pre">MacOS</span></code> &#8212; Access to Mac OS interpreter features</a></p>
 
219
  <h4>Next topic</h4>
 
220
  <p class="topless"><a href="easydialogs.html"
 
221
                        title="next chapter">37.5. <code class="docutils literal"><span class="pre">EasyDialogs</span></code> &#8212; Basic Macintosh dialogs</a></p>
 
222
<h3>This Page</h3>
 
223
<ul class="this-page-menu">
 
224
  <li><a href="../bugs.html">Report a Bug</a></li>
 
225
  <li><a href="../_sources/library/macostools.txt"
 
226
         rel="nofollow">Show Source</a></li>
 
227
</ul>
 
228
 
 
229
<div id="searchbox" style="display: none" role="search">
 
230
  <h3>Quick search</h3>
 
231
    <form class="search" action="../search.html" method="get">
 
232
      <input type="text" name="q" />
 
233
      <input type="submit" value="Go" />
 
234
      <input type="hidden" name="check_keywords" value="yes" />
 
235
      <input type="hidden" name="area" value="default" />
 
236
    </form>
 
237
    <p class="searchtip" style="font-size: 90%">
 
238
    Enter search terms or a module, class or function name.
 
239
    </p>
 
240
</div>
 
241
<script type="text/javascript">$('#searchbox').show(0);</script>
 
242
        </div>
 
243
      </div>
 
244
      <div class="clearer"></div>
 
245
    </div>  
 
246
    <div class="related" role="navigation" aria-label="related navigation">
 
247
      <h3>Navigation</h3>
 
248
      <ul>
 
249
        <li class="right" style="margin-right: 10px">
 
250
          <a href="../genindex.html" title="General Index"
 
251
             >index</a></li>
 
252
        <li class="right" >
 
253
          <a href="../py-modindex.html" title="Python Module Index"
 
254
             >modules</a> |</li>
 
255
        <li class="right" >
 
256
          <a href="easydialogs.html" title="37.5. EasyDialogs — Basic Macintosh dialogs"
 
257
             >next</a> |</li>
 
258
        <li class="right" >
 
259
          <a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
 
260
             >previous</a> |</li>
 
261
        <li><img src="../_static/py.png" alt=""
 
262
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
263
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
264
        <li>
 
265
          <span class="version_switcher_placeholder">2.7.12</span>
 
266
          <a href="../index.html">Documentation</a> &raquo;
 
267
        </li>
 
268
 
 
269
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
270
          <li class="nav-item nav-item-2"><a href="mac.html" >37. Mac OS X specific services</a> &raquo;</li> 
 
271
      </ul>
 
272
    </div>  
 
273
    <div class="footer">
 
274
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
 
275
    <br />
 
276
    The Python Software Foundation is a non-profit corporation.
 
277
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
278
    <br />
 
279
    Last updated on Sep 20, 2016.
 
280
    <a href="../bugs.html">Found a bug</a>?
 
281
    <br />
 
282
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
283
    </div>
 
284
 
 
285
  </body>
 
286
</html>
 
 
b'\\ No newline at end of file'