kdeldycke / mail-deduplicate

📧 CLI to deduplicate mails from mail boxes
https://kdeldycke.github.io/mail-deduplicate
GNU General Public License v2.0
165 stars 37 forks source link

TypeError: splitlines() takes no keyword arguments #90

Closed leggewie closed 4 years ago

leggewie commented 4 years ago

I use version 3.0.0, installed via pip on Ubuntu Bionic. That means, my standard python interpreter is python 2.7.17. That leads to the following TypeError when the splitlines function is called.

$ mdedup deduplicate -n ~/Maildir/.DAMAGED20200924.Usenet-Speicher/ ~/Maildir/.Usenet-Speicher/
=== Phase #1: load mails and compute hashes.
Opening /home/leggewie/Maildir/.DAMAGED20200924.Usenet-Speicher as a maildir...
35 mails found.
100%|################################################################################################################|
Opening /home/leggewie/Maildir/.Usenet-Speicher as a maildir...
35 mails found.
100%|################################################################################################################|
=== Phase #2: deduplicate mails.
warning: No removal strategy will be applied.
--- 2 mails sharing hash 38deda92254b1c34c6a538a2737de8904e636f29b96865242bc27681
Check that mail differences are within the limits.
Traceback (most recent call last):
  File "/home/leggewie/.local/bin/mdedup", line 11, in <module>
    sys.exit(cli())
  File "/home/leggewie/.local/lib/python2.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/leggewie/.local/lib/python2.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/leggewie/.local/lib/python2.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/leggewie/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/leggewie/.local/lib/python2.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/leggewie/.local/lib/python2.7/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/leggewie/.local/lib/python2.7/site-packages/mail_deduplicate/cli.py", line 217, in deduplicate
    dedup.run()
  File "/home/leggewie/.local/lib/python2.7/site-packages/mail_deduplicate/deduplicate.py", line 579, in run
    duplicates.check_differences()
  File "/home/leggewie/.local/lib/python2.7/site-packages/mail_deduplicate/deduplicate.py", line 132, in check_differences
    size_difference = abs(mail_a.size - mail_b.size)
  File "/home/leggewie/.local/lib/python2.7/site-packages/boltons/cacheutils.py", line 610, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/home/leggewie/.local/lib/python2.7/site-packages/mail_deduplicate/mail.py", line 118, in size
    return len(''.join(self.body_lines))
  File "/home/leggewie/.local/lib/python2.7/site-packages/boltons/cacheutils.py", line 610, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/home/leggewie/.local/lib/python2.7/site-packages/mail_deduplicate/mail.py", line 159, in body_lines
    body.extend(part_body.splitlines(keepends=True))
TypeError: splitlines() takes no keyword arguments
leggewie commented 4 years ago

I can get past this error in python2 by replacing body.extend(part_body.splitlines(keepends=True)) with body.extend(part_body.splitlines(True)). I will then get past this one and run into a different error. The change in syntax seems to be a difference between python2 and python3 according to the docs.

Is mail-deduplicate still supported on python2? It is available for it via pip.

kdeldycke commented 4 years ago

Thanks @leggewie for the bug report.

mail-deduplicate v3.0.0 was supposed to be a short-lived transitional breaking release to reserve the project name on PyPi. Because I was time-constrained I choose to compromise on quality and have it out as fast as possible.

The plan was then to fix all remaining issues in v4.0.0 but I still have a couple of issues to fix. All in all Python 2.x is no longer supported, but I did not properly remove it for the v3.0.0 release. Hence the inconsistent mention of Python 2.x support you encountered via pip.

I'll try to cut a 4.0.0 release to have that strange state of affair settled for good though. In the mean time, I'll close the issue.

github-actions[bot] commented 3 years ago

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.