NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.52k stars 13k forks source link

paperless-ng mail-fetching broken #160376

Open a7p opened 2 years ago

a7p commented 2 years ago

Describe the bug

Fetching email won't work.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Configure an email account + an email rule
  2. wait
  3. look at mail.log

Expected behavior

Mail get's fetched

Additional context

paperless-ng's requirements pin imap-tools==0.46.0 https://github.com/jonaswinkler/paperless-ng/blob/master/requirements.txt#L48

The used nixpkgs version is at 0.50.2 https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/imap-tools/default.nix#L10

Mailbox.seen got deprecated in 0.46 and was removed 0.47 in https://github.com/ikvk/imap_tools/blob/f070869d3d9f4f4d82ae6683bee6211a7b571eb2/docs/release_notes.rst#0470

[2022-02-16 21:09:55,267] [DEBUG] [paperless_mail] Processing mail account mail@domain.com
[2022-02-16 21:09:56,172] [DEBUG] [paperless_mail] Account mail@domain.com: Processing 1 rule(s)
[2022-02-16 21:09:56,176] [DEBUG] [paperless_mail] Rule mail@domain.com.Invoice-Mailbox: Selecting folder Invoices
[2022-02-16 21:09:56,258] [DEBUG] [paperless_mail] Rule mail@domain.com.Invoice-Mailbox: Searching folder with criteria (SINCE 17-Jan-2022 UNSEEN)
[2022-02-16 21:09:56,338] [DEBUG] [paperless_mail] Rule mail@domain.com.Invoice-Mailbox: Processed 0 matching mail(s)
[2022-02-16 21:09:56,339] [DEBUG] [paperless_mail] Rule mail@domain.com.Invoice-Mailbox: Running mail actions on 0 mails
[2022-02-16 21:09:56,340] [ERROR] [paperless_mail] Rule mail@domain.com.Invoice-Mailbox: Error while processing rule: Rule mail@domain.com.Invoice-Mailbox: Error while processing post-consume actions: 'MailBox' object has no attribute 'seen'
Traceback (most recent call last):
  File "/nix/store/65p8ahg3d8h98xvirnhb4mcczxcfz808-paperless-ng-1.5.0/lib/paperless-ng/src/paperless_mail/mail.py", line 241, in handle_mail_rule
    get_rule_action(rule).post_consume(
  File "/nix/store/65p8ahg3d8h98xvirnhb4mcczxcfz808-paperless-ng-1.5.0/lib/paperless-ng/src/paperless_mail/mail.py", line 45, in post_consume
    M.seen(message_uids, True)
AttributeError: 'MailBox' object has no attribute 'seen'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/nix/store/65p8ahg3d8h98xvirnhb4mcczxcfz808-paperless-ng-1.5.0/lib/paperless-ng/src/paperless_mail/mail.py", line 172, in handle_mail_account
    total_processed_files += self.handle_mail_rule(M, rule)
  File "/nix/store/65p8ahg3d8h98xvirnhb4mcczxcfz808-paperless-ng-1.5.0/lib/paperless-ng/src/paperless_mail/mail.py", line 247, in handle_mail_rule
    raise MailError(
paperless_mail.mail.MailError: Rule mail@domain.de.de.Invoice-Mailbox: Error while processing post-consume actions: 'MailBox' object has no attribute 'seen'

Notify maintainers

@dotlambda

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.21, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.11.335883.7adc9c14ec7"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
gador commented 2 years ago

There is a new fork of paperless-ng called paperless-ngx. I'd appreciate, if you could open a bug report there. If the new fork gets enough traction, I'll submit a PR here to point to the new version.

a7p commented 2 years ago

I'd appreciate, if you could open a bug report there.

but it's not a bug, it's just ignoring a dependency restriction on nixpkgs side. requirements and code regarding imap-tools is exactly the same in paperless-ng and paperless-ngx, also there's no pending PR in paperless-ngx that'd make it work with newer versions of imap-tools. Thank's for pointing me to paperless-ngx - the nature of the tool really requires longvivity.

I could create a PR overriding the used imap-tools version - is that the way to go?

gador commented 2 years ago

ah sorry, I must have overlooked that part.

I could create a PR overriding the used imap-tools version - is that the way to go?

Yes, I'd think so. At least for now. For the long run, we'd need to update the dependency on paperless.

dotlambda commented 2 years ago

Notify maintainers

@dotlambda

I've never been a maintainer of paperless-ng. The maintainers are @erikarvstedt and @Flakebi.

Valodim commented 2 years ago

If the new fork gets enough traction, I'll submit a PR here to point to the new version.

definitelyseems like that, going by https://github.com/jonaswinkler/paperless-ng/issues/1599 and https://github.com/jonaswinkler/paperless-ng/issues/1632. The paperless-ngx repo has 1.8k stars already at this point, has almost daily active commits by contributors previously active on -ng, and seems to be mostly recognized as the new upstream.

gador commented 2 years ago

@a7p is this still an issue? Have you tried the paperless-ngx 1.6 version?