I did a change in offlineimaprc and got duplicated messages

Sebastian Spaeth Sebastian at SSpaeth.de
Tue Jun 14 09:04:38 BST 2011

On Sun, 12 Jun 2011 22:47:50 +0000 (UTC), Marcelo Luiz de Laia wrote:
> http://stuvel.eu//blog/109/removing-duplicate-mails

Nice link, we should be saving such things (i just pointed to the blog
entry from https://github.com/spaetz/offlineimaporg/wiki for now).
> But, it didnt work for me!

Welcome to the wonderfully broken world of email and IMAP. 

> :~/Mail/GMail/Enviados$ python removedups.py 
> Traceback (most recent call last):
>   File "removedups.py", line 38, in <module>
>     dedupe(dir)
>   File "removedups.py", line 18, in dedupe
>     for (key, message) in box.iteritems():
>   File "/usr/lib/python2.6/mailbox.py", line 124, in iteritems
>     for key in self.iterkeys():
>   File "/usr/lib/python2.6/mailbox.py", line 352, in iterkeys
>     self._refresh()
>   File "/usr/lib/python2.6/mailbox.py", line 473, in _refresh
>     for entry in os.listdir(subdir_path):
> OSError: [Errno 2] No such file or directory:
> '/home/marcelo/Mail/GMail/Enviados/new/new'

As he has written that it is a python 3 script, I would try to run it
with python3. Otherwise you seem to have hit a bug in the pyhthon
"mailbox" module, it seems.

> If I run it on GMail dir, instead, I got:
> KeyError: 'message-id'

Seems, like you have a message or a file without a Message-Id
header. This is illegal but anything can happen with emails. Why don't
you protect the script with:

if not message.has_key('Message-Id'):

before the line:

 mid = message['Message-Id']

Otherwise, I suggest contacting the blog author who wrote the script

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110614/40ad52fd/attachment-0001.sig>

More information about the OfflineIMAP-project mailing list