Skip to content

TypeError: 'NoneType' object has no attribute '__getitem__' round 2 #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
freywald opened this issue Apr 1, 2018 · 2 comments
Closed
Labels
🐛 bug Something isn't working, or a fix is proposed

Comments

@freywald
Copy link

freywald commented Apr 1, 2018

Hi,

thanks for your software. I encountered a bug.

The command:

$ mdedup deduplicate -t date-header -s delete-newer -n .Archives.2001

The version (installed from source):

$ mdedup --version
mdedup, version 2.2.0

OS version

$ cat /etc/issue
Ubuntu Bionic Beaver (development branch) \n \l

The log:

=== Start phase #1: load mails and compute hashes.
Opening maildir at .............Archives.2001 ...
2 mails found.
100%|##########################################################################################################################################################|
=== Start phase #2: deduplicate mails.
The delete-newer strategy will be applied on each duplicate set.
---
Check that mail differences are within the limits.
Traceback (most recent call last):
  File "/usr/local/bin/mdedup", line 11, in <module>
    load_entry_point('maildir-deduplicate==2.2.0', 'console_scripts', 'mdedup')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "build/bdist.linux-x86_64/egg/maildir_deduplicate/cli.py", line 209, in deduplicate
  File "build/bdist.linux-x86_64/egg/maildir_deduplicate/deduplicate.py", line 554, in run
  File "build/bdist.linux-x86_64/egg/maildir_deduplicate/deduplicate.py", line 206, in dedupe
  File "build/bdist.linux-x86_64/egg/maildir_deduplicate/deduplicate.py", line 192, in apply_strategy
  File "build/bdist.linux-x86_64/egg/maildir_deduplicate/deduplicate.py", line 279, in delete_newer
  File "/usr/local/lib/python2.7/dist-packages/boltons/cacheutils.py", line 660, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "build/bdist.linux-x86_64/egg/maildir_deduplicate/deduplicate.py", line 99, in oldest_timestamp
  File "/usr/local/lib/python2.7/dist-packages/boltons/cacheutils.py", line 660, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "build/bdist.linux-x86_64/egg/maildir_deduplicate/mail.py", line 82, in timestamp
  File "/usr/lib/python2.7/email/_parseaddr.py", line 154, in mktime_tz
    if data[9] is None:
TypeError: 'NoneType' object has no attribute '__getitem__'

The culprit: I've tracked the bug down to two duplicate mails which are simply missing a date header. If I add the following line to the mails the program completes successfully.

Date: Fri, 28 Feb 2003 09:02:38 +0100

Maybe this case is related #24 ?

Example mail (reduced case)

X-Mozilla-Status: 0009
X-Mozilla-Status2: 00000000
X-Account-Key: account3
Subject: 
Message-ID: <000501cf4ab3$da480c70$8ed82550$@Domain>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0006_01CF4ABC.3C0C7470"
X-Mailer: Microsoft Outlook 15.0
Content-Language: de
X-MailStoreMapiMimePostProcessor: 8.1.0.9075
X-MailStore-Folder-UTF7: default/Outlook Outlook Data File/Personal
X-MailStore-Message-ID: <[email protected]>
X-MailStore-Header-Hash: 0000000000000000000000000000000000000000
X-MailStore-Date: 20091216134939
X-MailStore-Flags: 0

------=_NextPart_000_0006_01CF4ABC.3C0C7470
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit


....


------=_NextPart_000_0006_01CF4ABC.3C0C7470
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
....
</BODY>
</HTML>
------=_NextPart_000_0006_01CF4ABC.3C0C7470--
@kdeldycke kdeldycke added the bug label Sep 3, 2020
@kdeldycke
Copy link
Owner

This bug has likely been fixed in all the old PR that have been merged upstream since them. Let's close it.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 14, 2020
@kdeldycke kdeldycke added 🐛 bug Something isn't working, or a fix is proposed and removed bug labels Nov 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working, or a fix is proposed
Projects
None yet
Development

No branches or pull requests

2 participants