<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span><br></span></div><div><br></div><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><br></font>On Mon, 2 May 2011 07:52:22 -0700 (PDT), chris coleman <<a ymailto="mailto:christocoleman@yahoo.com" href="mailto:christocoleman@yahoo.com">christocoleman@yahoo.com</a>> wrote:<br>> Thanks Sebastian and Nicolas.<br>> <br>> The corrupt data has been found.<br>> <br>> You're right it was indeed in the huge file ~/.offlineimap/Repository-IMAPLocal<username>/UIDMapping/INBOX.Sent  <br>> <br>> Here are a few lines before and after :<br>> 16731:4777<br>> 16732:4778<br>> 16733:4779<br>> 16734:  P    35:4781<br>>
 16736:4782<br>> 16737:4783<br>> 16738:4784<br>> They're consecutive UIDs so I re-entered them and filled in the missing numbers in the sequence.<br>> <br>> With the INBOX.Sent file repaired in this user, I re-ran it, and we're down to this same basic error on both mailboxes:<br>> <br>> <br>> "WARNING: ERROR in syncfolder for username1: null byte in argument for long()"<br>> "WARNING: ERROR in syncfolder for username2: null byte in argument for long()"<br>> <br>> <br>> Do you have a patch for this "ERROR in syncfolder", to pinpoint the line number and filename ?<br><br>The error most likely occurs in offlineimap/offlineimap/folder/IMAP.py<br>around line 162 in the cachemessagelist() function<br><br>What happens is that we select a folder in line 111 in:<br><br>imaptype, imapdata = imapobj.select(self.getfullname(), readonly = 1, force = 1)<br><br>and later in line 162 we go through the returned data, trying to get
 the<br>highest UID number that the select call returned:<br><br>                for msgid in imapdata:<br>                    maxmsgid = max(long(msgid), maxmsgid)<br><br>If you could add some debug code in the form<br><br>                for msgid in imapdata:<br>                    try:<br>                        maxmsgid = max(long(msgid), maxmsgid)<br>                    except:<br>                        raise Exception(str(imapdata))<br><br>and let us see what exactly had been returned in imapdata we could try<br>to work this out.<br><br>Let me know if you need more help in making the code changes. I
 hope we<br>get this one nailed down.<br><br>Sebastian<br><br>============<br><br>I'm on 6.3.2-0 because it's the highest that will run on debian 5.0 (lenny).<br><br>The catch is, 6.3.2-0 code for offlineimap/offlineimap/folder/IMAP.py is using imapobj not imapdata - so it seems like your patch would need modification to fit.<br><br>Here is the code excerpted from lines 175-188:<br><br>                try:<br>                    # 1. Some mail servers do not return an EXISTS response<br>                    # if the folder is empty.  2. ZIMBRA servers can return<br>                    # multiple
 EXISTS replies in the form 500, 1000, 1500,<br>                    # 1623 so check for potentially multiple replies.<br>                    maxmsgid = 0<br>                    for msgid in imapobj.untagged_responses['EXISTS']:<br>                        maxmsgid = max(long(msgid), maxmsgid)<br>                    messagesToFetch = '1:%d' % maxmsgid;<br>                except
 KeyError:<br>                    return<br>                if maxmsgid < 1:<br>                    #no messages; return<br>                    return<br><br>Your suggestion on how to patch this ?<br><br>Chris<br><br></div></div></div></body></html>