ERROR: 'NoneType' object has no attribute '__getitem__'

Dmitrijs Ledkovs xnox at debian.org
Wed Jun 13 10:27:17 BST 2012


Hello all,

On 13/06/12 08:16, Tomasz Żok wrote:
> Hi Eric,
> 
> I am attaching the patch to this bug which I mentioned in the private email to
> you. I created it for 6.5.3.1, so maybe you should find and fix the faulty line
> yourself in IMAP.py as the diff below says:
> 
> In file: /usr/lib/python2.7/site-packages/offlineimap/folder/IMAP.py
> 585c585
> <                 if resp == [None]:
> ---
>>                 if not resp or resp == [None]:
> 

What about this?

>From 01f580c0148aaad2f23a1f08516d9911b2d3ec78 Mon Sep 17 00:00:00 2001
From: Dmitrijs Ledkovs <xnox at debian.org>
Date: Wed, 13 Jun 2012 10:25:42 +0100
Subject: [PATCH] _get_untagged_response should always return a list

Even if it's just a [None].

Signed-off-by: Dmitrijs Ledkovs <xnox at debian.org>
---
 offlineimap/imaplib2.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/offlineimap/imaplib2.py b/offlineimap/imaplib2.py
index 8138d6c..bb51e3b 100644
--- a/offlineimap/imaplib2.py
+++ b/offlineimap/imaplib2.py
@@ -1434,7 +1434,7 @@ class IMAP4(object):
                 return dat

         self.commands_lock.release()
-        return None
+        return [None]


     def _match(self, cre, s):
-- 
1.7.10.4




> Cheers,
> Tomek
> 
> 
> On 06/11/12 at 11:20am, Eric Schulte wrote:
>> Hi,
>>
>> I'm receiving the following error [1] on every sync with one of my
>> mailboxes.  Incidentally I also have one message in that mailbox which
>> is duplicated on every sync (which becomes problematic with regular
>> crontab syncs).  I copied the duplicating message over from a mailbox on
>> another remote IMAP server.
>>
>> Any idea what the cause of this error could be?  I'm running version
>> 6.5.4 of offlineimap installed using pacman on Arch Linux.
>>
>> Thanks,
>>
>> Footnotes: 
>> [1]  ERROR: 'NoneType' object has no attribute '__getitem__'
>>      Thread 'Copy message from school-local:unm.school' terminated with exception:
>>      Traceback (most recent call last):
>>      File "/usr/lib/python2.7/site-packages/offlineimap/threadutil.py", line 156, in run
>>      Thread.run(self)
>>      File "/usr/lib/python2.7/threading.py", line 504, in run
>>      self.__target(*self.__args, **self.__kwargs)
>>      File "/usr/lib/python2.7/site-packages/offlineimap/folder/Base.py", line 335, in copymessageto
>>      new_uid = dstfolder.savemessage(uid, message, flags, rtime)
>>      File "/usr/lib/python2.7/site-packages/offlineimap/folder/IMAP.py", line 592, in savemessage
>>      uid = long(resp[-1].split(' ')[1])
>>      TypeError: 'NoneType' object has no attribute '__getitem__'
>>
>> -- 
>> Eric Schulte
>> http://cs.unm.edu/~eschulte
>>
>> _______________________________________________
>> OfflineIMAP-project mailing list
>> OfflineIMAP-project at lists.alioth.debian.org
>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
>>
>> OfflineIMAP homepage: http://software.complete.org/offlineimap
>>
>>
>> _______________________________________________
>> OfflineIMAP-project mailing list
>> OfflineIMAP-project at lists.alioth.debian.org
>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
>>
>> OfflineIMAP homepage: http://software.complete.org/offlineimap


-- 
Regards,
Dmitrijs.




More information about the OfflineIMAP-project mailing list