<p>This patch work for me:</p>
<div class="highlight highlight-source-diff"><pre>modified offlineimap/imaplib2.py
old mode 100644
new mode 100755
<span class="pl-mdr">@@ -578,7 +578,11 @@</span> class IMAP4(object):
Close I/O established in "open"."""
try:
<span class="pl-md">- self.sock.shutdown(socket.SHUT_RDWR)</span>
<span class="pl-mi1">+ self.sock.shutdown(socket.SHUT_WR)</span>
<span class="pl-mi1">+ try:</span>
<span class="pl-mi1">+ self.sock.shutdown(socket.SHUT_RD)</span>
<span class="pl-mi1">+ except:</span>
<span class="pl-mi1">+ pass</span>
except OSError as e:
# The server might already have closed the connection
if e.errno != errno.ENOTCONN:</pre></div>
<p>This is correct since the <code>LOGOUT</code> command has already been sent and this bug seems to be MacOSX specific I guess this is because internally <code>SHUT_RDWR</code> is done in 2 steps.</p>
<p>What I don't understand is that in V6.5.7 the behaviour is different (i haven't diff all the code though).</p>
<p>From Python doc:</p>
<blockquote>
<p>Shut down one or both halves of the connection. If how is SHUT_RD, further<br>
receives are disallowed. If how is SHUT_WR, further sends are disallowed. If<br>
how is SHUT_RDWR, further sends and receives > are disallowed. Depending on<br>
the platform, shutting down one half of the connection can also close the<br>
opposite half (e.g. on Mac OS X, shutdown(SHUT_WR) does not allow further<br>
reads on the other end of the connection).</p>
</blockquote>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OfflineIMAP/offlineimap/issues/205#issuecomment-153516367">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AKFSEL6WdkCcfUaRMOHcPBs1SfUtMeuRks5pCTRrgaJpZM4EjkWN.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/OfflineIMAP/offlineimap/issues/205#issuecomment-153516367"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>