[ SEA-GHOST MINI SHELL]

Path : /proc/2/root/proc/2/root/proc/3/cwd/usr/share/doc/python-docs-2.7.5/html/library/
FILE UPLOADER :
Current File : //proc/2/root/proc/2/root/proc/3/cwd/usr/share/doc/python-docs-2.7.5/html/library/mmap.html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>16.7. mmap — Memory-mapped file support &mdash; Python 2.7.5 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.7.5',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.5 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 2.7.5 documentation" href="../index.html" />
    <link rel="up" title="16. Optional Operating System Services" href="someos.html" />
    <link rel="next" title="16.8. readline — GNU readline interface" href="readline.html" />
    <link rel="prev" title="16.6. multiprocessing — Process-based “threading” interface" href="multiprocessing.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="readline.html" title="16.8. readline — GNU readline interface"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="multiprocessing.html" title="16.6. multiprocessing — Process-based “threading” interface"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="someos.html" accesskey="U">16. Optional Operating System Services</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-mmap">
<span id="mmap-memory-mapped-file-support"></span><h1>16.7. <a class="reference internal" href="#module-mmap" title="mmap: Interface to memory-mapped files for Unix and Windows."><tt class="xref py py-mod docutils literal"><span class="pre">mmap</span></tt></a> &#8212; Memory-mapped file support<a class="headerlink" href="#module-mmap" title="Permalink to this headline">¶</a></h1>
<p>Memory-mapped file objects behave like both strings and like file objects.
Unlike normal string objects, however, these are mutable.  You can use mmap
objects in most places where strings are expected; for example, you can use
the <a class="reference internal" href="re.html#module-re" title="re: Regular expression operations."><tt class="xref py py-mod docutils literal"><span class="pre">re</span></tt></a> module to search through a memory-mapped file.  Since they&#8217;re
mutable, you can change a single character by doing <tt class="docutils literal"><span class="pre">obj[index]</span> <span class="pre">=</span> <span class="pre">'a'</span></tt>, or
change a substring by assigning to a slice: <tt class="docutils literal"><span class="pre">obj[i1:i2]</span> <span class="pre">=</span> <span class="pre">'...'</span></tt>.  You can
also read and write data starting at the current file position, and
<a class="reference internal" href="#mmap.seek" title="mmap.seek"><tt class="xref py py-meth docutils literal"><span class="pre">seek()</span></tt></a> through the file to different positions.</p>
<p>A memory-mapped file is created by the <a class="reference internal" href="#module-mmap" title="mmap: Interface to memory-mapped files for Unix and Windows."><tt class="xref py py-class docutils literal"><span class="pre">mmap</span></tt></a> constructor, which is
different on Unix and on Windows.  In either case you must provide a file
descriptor for a file opened for update. If you wish to map an existing Python
file object, use its <tt class="xref py py-meth docutils literal"><span class="pre">fileno()</span></tt> method to obtain the correct value for the
<em>fileno</em> parameter.  Otherwise, you can open the file using the
<a class="reference internal" href="os.html#os.open" title="os.open"><tt class="xref py py-func docutils literal"><span class="pre">os.open()</span></tt></a> function, which returns a file descriptor directly (the file
still needs to be closed when done).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you want to create a memory-mapping for a writable, buffered file, you
should <a class="reference internal" href="io.html#io.IOBase.flush" title="io.IOBase.flush"><tt class="xref py py-func docutils literal"><span class="pre">flush()</span></tt></a> the file first.  This is necessary to ensure
that local modifications to the buffers are actually available to the
mapping.</p>
</div>
<p>For both the Unix and Windows versions of the constructor, <em>access</em> may be
specified as an optional keyword parameter. <em>access</em> accepts one of three
values: <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_READ</span></tt>, <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_WRITE</span></tt>, or <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_COPY</span></tt>
to specify read-only, write-through or copy-on-write memory respectively.
<em>access</em> can be used on both Unix and Windows.  If <em>access</em> is not specified,
Windows mmap returns a write-through mapping.  The initial memory values for
all three access types are taken from the specified file.  Assignment to an
<tt class="xref py py-const docutils literal"><span class="pre">ACCESS_READ</span></tt> memory map raises a <a class="reference internal" href="exceptions.html#exceptions.TypeError" title="exceptions.TypeError"><tt class="xref py py-exc docutils literal"><span class="pre">TypeError</span></tt></a> exception.
Assignment to an <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_WRITE</span></tt> memory map affects both memory and the
underlying file.  Assignment to an <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_COPY</span></tt> memory map affects
memory but does not update the underlying file.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 2.5: </span>To map anonymous memory, -1 should be passed as the fileno along with the
length.</p>
<p class="versionchanged">
<span class="versionmodified">Changed in version 2.6: </span>mmap.mmap has formerly been a factory function creating mmap objects. Now
mmap.mmap is the class itself.</p>
<dl class="class">
<dt id="mmap.mmap">
<em class="property">class </em><tt class="descclassname">mmap.</tt><tt class="descname">mmap</tt><big>(</big><em>fileno</em>, <em>length</em><span class="optional">[</span>, <em>tagname</em><span class="optional">[</span>, <em>access</em><span class="optional">[</span>, <em>offset</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#mmap.mmap" title="Permalink to this definition">¶</a></dt>
<dd><p><strong>(Windows version)</strong> Maps <em>length</em> bytes from the file specified by the
file handle <em>fileno</em>, and creates a mmap object.  If <em>length</em> is larger
than the current size of the file, the file is extended to contain <em>length</em>
bytes.  If <em>length</em> is <tt class="docutils literal"><span class="pre">0</span></tt>, the maximum length of the map is the current
size of the file, except that if the file is empty Windows raises an
exception (you cannot create an empty mapping on Windows).</p>
<p><em>tagname</em>, if specified and not <tt class="docutils literal"><span class="pre">None</span></tt>, is a string giving a tag name for
the mapping.  Windows allows you to have many different mappings against
the same file.  If you specify the name of an existing tag, that tag is
opened, otherwise a new tag of this name is created.  If this parameter is
omitted or <tt class="docutils literal"><span class="pre">None</span></tt>, the mapping is created without a name.  Avoiding the
use of the tag parameter will assist in keeping your code portable between
Unix and Windows.</p>
<p><em>offset</em> may be specified as a non-negative integer offset. mmap references
will be relative to the offset from the beginning of the file. <em>offset</em>
defaults to 0.  <em>offset</em> must be a multiple of the ALLOCATIONGRANULARITY.</p>
</dd></dl>

<dl class="class">
<dt>
<em class="property">class </em><tt class="descclassname">mmap.</tt><tt class="descname">mmap</tt><big>(</big><em>fileno</em>, <em>length</em><span class="optional">[</span>, <em>flags</em><span class="optional">[</span>, <em>prot</em><span class="optional">[</span>, <em>access</em><span class="optional">[</span>, <em>offset</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big></dt>
<dd><p><strong>(Unix version)</strong> Maps <em>length</em> bytes from the file specified by the file
descriptor <em>fileno</em>, and returns a mmap object.  If <em>length</em> is <tt class="docutils literal"><span class="pre">0</span></tt>, the
maximum length of the map will be the current size of the file when
<a class="reference internal" href="#module-mmap" title="mmap: Interface to memory-mapped files for Unix and Windows."><tt class="xref py py-class docutils literal"><span class="pre">mmap</span></tt></a> is called.</p>
<p><em>flags</em> specifies the nature of the mapping. <tt class="xref py py-const docutils literal"><span class="pre">MAP_PRIVATE</span></tt> creates a
private copy-on-write mapping, so changes to the contents of the mmap
object will be private to this process, and <tt class="xref py py-const docutils literal"><span class="pre">MAP_SHARED</span></tt> creates a
mapping that&#8217;s shared with all other processes mapping the same areas of
the file.  The default value is <tt class="xref py py-const docutils literal"><span class="pre">MAP_SHARED</span></tt>.</p>
<p><em>prot</em>, if specified, gives the desired memory protection; the two most
useful values are <tt class="xref py py-const docutils literal"><span class="pre">PROT_READ</span></tt> and <tt class="xref py py-const docutils literal"><span class="pre">PROT_WRITE</span></tt>, to specify
that the pages may be read or written.  <em>prot</em> defaults to
<tt class="xref py py-const docutils literal"><span class="pre">PROT_READ</span> <span class="pre">|</span> <span class="pre">PROT_WRITE</span></tt>.</p>
<p><em>access</em> may be specified in lieu of <em>flags</em> and <em>prot</em> as an optional
keyword parameter.  It is an error to specify both <em>flags</em>, <em>prot</em> and
<em>access</em>.  See the description of <em>access</em> above for information on how to
use this parameter.</p>
<p><em>offset</em> may be specified as a non-negative integer offset. mmap references
will be relative to the offset from the beginning of the file. <em>offset</em>
defaults to 0.  <em>offset</em> must be a multiple of the PAGESIZE or
ALLOCATIONGRANULARITY.</p>
<p>To ensure validity of the created memory mapping the file specified
by the descriptor <em>fileno</em> is internally automatically synchronized
with physical backing store on Mac OS X and OpenVMS.</p>
<p>This example shows a simple way of using <a class="reference internal" href="#module-mmap" title="mmap: Interface to memory-mapped files for Unix and Windows."><tt class="xref py py-class docutils literal"><span class="pre">mmap</span></tt></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">mmap</span>

<span class="c"># write a simple example file</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s">&quot;hello.txt&quot;</span><span class="p">,</span> <span class="s">&quot;wb&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
    <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&quot;Hello Python!</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>

<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s">&quot;hello.txt&quot;</span><span class="p">,</span> <span class="s">&quot;r+b&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
    <span class="c"># memory-map the file, size 0 means whole file</span>
    <span class="n">mm</span> <span class="o">=</span> <span class="n">mmap</span><span class="o">.</span><span class="n">mmap</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="mi">0</span><span class="p">)</span>
    <span class="c"># read content via standard file methods</span>
    <span class="k">print</span> <span class="n">mm</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>  <span class="c"># prints &quot;Hello Python!&quot;</span>
    <span class="c"># read content via slice notation</span>
    <span class="k">print</span> <span class="n">mm</span><span class="p">[:</span><span class="mi">5</span><span class="p">]</span>  <span class="c"># prints &quot;Hello&quot;</span>
    <span class="c"># update content using slice notation;</span>
    <span class="c"># note that new content must have same size</span>
    <span class="n">mm</span><span class="p">[</span><span class="mi">6</span><span class="p">:]</span> <span class="o">=</span> <span class="s">&quot; world!</span><span class="se">\n</span><span class="s">&quot;</span>
    <span class="c"># ... and read again using standard file methods</span>
    <span class="n">mm</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
    <span class="k">print</span> <span class="n">mm</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>  <span class="c"># prints &quot;Hello  world!&quot;</span>
    <span class="c"># close the map</span>
    <span class="n">mm</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>The next example demonstrates how to create an anonymous map and exchange
data between the parent and child processes:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">mmap</span>
<span class="kn">import</span> <span class="nn">os</span>

<span class="n">mm</span> <span class="o">=</span> <span class="n">mmap</span><span class="o">.</span><span class="n">mmap</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">13</span><span class="p">)</span>
<span class="n">mm</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&quot;Hello world!&quot;</span><span class="p">)</span>

<span class="n">pid</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">fork</span><span class="p">()</span>

<span class="k">if</span> <span class="n">pid</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c"># In a child process</span>
    <span class="n">mm</span><span class="o">.</span><span class="n">seek</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
    <span class="k">print</span> <span class="n">mm</span><span class="o">.</span><span class="n">readline</span><span class="p">()</span>

    <span class="n">mm</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>Memory-mapped file objects support the following methods:</p>
<dl class="method">
<dt id="mmap.close">
<tt class="descclassname">mmap.</tt><tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#mmap.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the file.  Subsequent calls to other methods of the object will
result in an exception being raised.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.find">
<tt class="descclassname">mmap.</tt><tt class="descname">find</tt><big>(</big><em>string</em><span class="optional">[</span>, <em>start</em><span class="optional">[</span>, <em>end</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#mmap.find" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the lowest index in the object where the substring <em>string</em> is
found, such that <em>string</em> is contained in the range [<em>start</em>, <em>end</em>].
Optional arguments <em>start</em> and <em>end</em> are interpreted as in slice notation.
Returns <tt class="docutils literal"><span class="pre">-1</span></tt> on failure.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.flush">
<tt class="descclassname">mmap.</tt><tt class="descname">flush</tt><big>(</big><span class="optional">[</span><em>offset</em>, <em>size</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#mmap.flush" title="Permalink to this definition">¶</a></dt>
<dd><p>Flushes changes made to the in-memory copy of a file back to disk. Without
use of this call there is no guarantee that changes are written back before
the object is destroyed.  If <em>offset</em> and <em>size</em> are specified, only
changes to the given range of bytes will be flushed to disk; otherwise, the
whole extent of the mapping is flushed.</p>
<p><strong>(Windows version)</strong> A nonzero value returned indicates success; zero
indicates failure.</p>
<p><strong>(Unix version)</strong> A zero value is returned to indicate success. An
exception is raised when the call failed.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.move">
<tt class="descclassname">mmap.</tt><tt class="descname">move</tt><big>(</big><em>dest</em>, <em>src</em>, <em>count</em><big>)</big><a class="headerlink" href="#mmap.move" title="Permalink to this definition">¶</a></dt>
<dd><p>Copy the <em>count</em> bytes starting at offset <em>src</em> to the destination index
<em>dest</em>.  If the mmap was created with <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_READ</span></tt>, then calls to
move will raise a <a class="reference internal" href="exceptions.html#exceptions.TypeError" title="exceptions.TypeError"><tt class="xref py py-exc docutils literal"><span class="pre">TypeError</span></tt></a> exception.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.read">
<tt class="descclassname">mmap.</tt><tt class="descname">read</tt><big>(</big><em>num</em><big>)</big><a class="headerlink" href="#mmap.read" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a string containing up to <em>num</em> bytes starting from the current
file position; the file position is updated to point after the bytes that
were returned.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.read_byte">
<tt class="descclassname">mmap.</tt><tt class="descname">read_byte</tt><big>(</big><big>)</big><a class="headerlink" href="#mmap.read_byte" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a string of length 1 containing the character at the current file
position, and advances the file position by 1.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.readline">
<tt class="descclassname">mmap.</tt><tt class="descname">readline</tt><big>(</big><big>)</big><a class="headerlink" href="#mmap.readline" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a single line, starting at the current file position and up to the
next newline.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.resize">
<tt class="descclassname">mmap.</tt><tt class="descname">resize</tt><big>(</big><em>newsize</em><big>)</big><a class="headerlink" href="#mmap.resize" title="Permalink to this definition">¶</a></dt>
<dd><p>Resizes the map and the underlying file, if any. If the mmap was created
with <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_READ</span></tt> or <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_COPY</span></tt>, resizing the map will
raise a <a class="reference internal" href="exceptions.html#exceptions.TypeError" title="exceptions.TypeError"><tt class="xref py py-exc docutils literal"><span class="pre">TypeError</span></tt></a> exception.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.rfind">
<tt class="descclassname">mmap.</tt><tt class="descname">rfind</tt><big>(</big><em>string</em><span class="optional">[</span>, <em>start</em><span class="optional">[</span>, <em>end</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#mmap.rfind" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the highest index in the object where the substring <em>string</em> is
found, such that <em>string</em> is contained in the range [<em>start</em>, <em>end</em>].
Optional arguments <em>start</em> and <em>end</em> are interpreted as in slice notation.
Returns <tt class="docutils literal"><span class="pre">-1</span></tt> on failure.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.seek">
<tt class="descclassname">mmap.</tt><tt class="descname">seek</tt><big>(</big><em>pos</em><span class="optional">[</span>, <em>whence</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#mmap.seek" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the file&#8217;s current position.  <em>whence</em> argument is optional and
defaults to <tt class="docutils literal"><span class="pre">os.SEEK_SET</span></tt> or <tt class="docutils literal"><span class="pre">0</span></tt> (absolute file positioning); other
values are <tt class="docutils literal"><span class="pre">os.SEEK_CUR</span></tt> or <tt class="docutils literal"><span class="pre">1</span></tt> (seek relative to the current
position) and <tt class="docutils literal"><span class="pre">os.SEEK_END</span></tt> or <tt class="docutils literal"><span class="pre">2</span></tt> (seek relative to the file&#8217;s end).</p>
</dd></dl>

<dl class="method">
<dt id="mmap.size">
<tt class="descclassname">mmap.</tt><tt class="descname">size</tt><big>(</big><big>)</big><a class="headerlink" href="#mmap.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the length of the file, which can be larger than the size of the
memory-mapped area.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.tell">
<tt class="descclassname">mmap.</tt><tt class="descname">tell</tt><big>(</big><big>)</big><a class="headerlink" href="#mmap.tell" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the current position of the file pointer.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.write">
<tt class="descclassname">mmap.</tt><tt class="descname">write</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#mmap.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the bytes in <em>string</em> into memory at the current position of the
file pointer; the file position is updated to point after the bytes that
were written. If the mmap was created with <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_READ</span></tt>, then
writing to it will raise a <a class="reference internal" href="exceptions.html#exceptions.TypeError" title="exceptions.TypeError"><tt class="xref py py-exc docutils literal"><span class="pre">TypeError</span></tt></a> exception.</p>
</dd></dl>

<dl class="method">
<dt id="mmap.write_byte">
<tt class="descclassname">mmap.</tt><tt class="descname">write_byte</tt><big>(</big><em>byte</em><big>)</big><a class="headerlink" href="#mmap.write_byte" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the single-character string <em>byte</em> into memory at the current
position of the file pointer; the file position is advanced by <tt class="docutils literal"><span class="pre">1</span></tt>. If
the mmap was created with <tt class="xref py py-const docutils literal"><span class="pre">ACCESS_READ</span></tt>, then writing to it will
raise a <a class="reference internal" href="exceptions.html#exceptions.TypeError" title="exceptions.TypeError"><tt class="xref py py-exc docutils literal"><span class="pre">TypeError</span></tt></a> exception.</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="multiprocessing.html"
                        title="previous chapter">16.6. <tt class="docutils literal"><span class="pre">multiprocessing</span></tt> &#8212; Process-based &#8220;threading&#8221; interface</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="readline.html"
                        title="next chapter">16.8. <tt class="docutils literal"><span class="pre">readline</span></tt> &#8212; GNU readline interface</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/library/mmap.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="readline.html" title="16.8. readline — GNU readline interface"
             >next</a> |</li>
        <li class="right" >
          <a href="multiprocessing.html" title="16.6. multiprocessing — Process-based “threading” interface"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="someos.html" >16. Optional Operating System Services</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2020, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Oct 13, 2020.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>

  </body>
</html>

SEA-GHOST - SHELL CODING BY SEA-GHOST