unexpected keyword argument 'timeout'

dtk d.t.k at gmx.de
Mon Apr 11 22:23:44 BST 2011


Hi guys,

thanks for all the support and the patches! I'm sorry it took me so long, but I
wasn't at the office before too early so had to work late.

Excerpts from Ethan Glasser-Camp's message of Mon Apr 11 18:25:42 +0200 2011:
> On 04/11/2011 11:13 AM, Iain Dalton wrote:
> > It gets further, then crashes again:
>
> OK.  Attached is a patch that fixes this new thing.
well, kind of.

[patch]
     def open(self, host, port):
         """The tunnelcmd comes in on host!"""
+        self.host = tunnelcmd
[/patch]

doesn't work, since the tunnel command is only known in the constructor, but not
in open():

[bash]
    $ ./offlineimap.py -c ../../configs/preauth.rc
     OfflineIMAP 6.3.2
    Copyright (C) 2002 - 2010 John Goerzen <john at complete.org>

    This software comes with ABSOLUTELY NO WARRANTY; see the file
    COPYING for details.  This is free software, and you are welcome
    to distribute it under the conditions laid out in COPYING.
    Account sync Test:
     ***** Processing account Test
     Copying folder structure from IMAP to Maildir
     Establishing connection to tunnel:ssh -q dtk at jade-hamburg.de MAIL='maildir:~/Maildir' /usr/lib/dovecot/imap.
     WARNING: Error occured attempting to sync account Test: Traceback (most recent call last):
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/accounts.py", line 191, in syncrunner
        self.sync(siglistener)
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/accounts.py", line 246, in sync
        remoterepos.syncfoldersto(localrepos, [statusrepos])
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/repository/Base.py", line 121, in syncfoldersto
        srcfolders = src.getfolders()
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/repository/IMAP.py", line 242, in getfolders
        imapobj = self.imapserver.acquireconnection()
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/imapserver.py", line 200, in acquireconnection
        timeout=socket.getdefaulttimeout())
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/imaplibutil.py", line 71, in __init__
        IMAP4.__init__(self, tunnelcmd, **kwargs)
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/imaplib2.py", line 308, in __init__
        self.open(host, port)
      File "/media/dump/offlineimap/git/offlineimap/offlineimap/imaplibutil.py", line 75, in open
        self.host = tunnelcmd
    NameError: global name 'tunnelcmd' is not defined

     ***** Finished processing account Test
    $
[/bash]

I can only assume we want something like

[bash]
    $ git diff offlineimap/imaplibutil.py
    diff --git a/offlineimap/imaplibutil.py b/offlineimap/imaplibutil.py
    index e7db32c..c1c0f42 100644
    --- a/offlineimap/imaplibutil.py
    +++ b/offlineimap/imaplibutil.py
    @@ -72,7 +72,7 @@ class IMAP4_Tunnel(UsefulIMAPMixIn, IMAP4):

         def open(self, host, port):
             """The tunnelcmd comes in on host!"""
    -        self.host = tunnelcmd
    +        self.host = host
             self.process = subprocess.Popen(host, shell=True, close_fds=True,
                             stdin=subprocess.PIPE, stdout=subprocess.PIPE)
             (self.outfd, self.infd) = (self.process.stdin, self.process.stdout)
    $
[/bash]

but with that modification, the first call in the last try block in the
constructor of IMAP4 that seems to fetch the IMAP server's greeting doesn't
return.

[bash]
    $ cat offlineimap/imaplib2.py | grep -n -B1 -A2 'self.welcome = '
    342-        try:
    343:            self.welcome = self._request_push(tag='continuation').get_response('IMAP4 protocol error: %s')[1]
    344-
    345-            if self._get_untagged_response('PREAUTH'):
    $
[/bash]


You're it! ;P
dtk





More information about the OfflineIMAP-project mailing list