[Python 3]rfc822 module has been removed

Authored by ghane on Mar 14 2022, 12:49 PM.



python 2.7 -3 ./ -d 9 lm

DeprecationWarning: in 3.x, rfc822 has been removed in favor of the email package

Diff Detail

rP pykolab
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ghane requested review of this revision.Mar 14 2022, 12:49 PM
ghane created this revision.
sicherha requested changes to this revision.Mar 15 2022, 12:10 AM
sicherha added a subscriber: sicherha.

The only rfc822 function used below is rfc822.parsedate(); according to, its email counterpart is not not email.parsedate() but email.utils.parsedate().

Since the email.utils module is already available in Python 2.7, I suggest the following:

  • In line 22, change import rfc822 to import email.utils
  • In line 199, change the call to rfc822.parsedate() to email.utils.parsedate()
This revision now requires changes to proceed.Mar 15 2022, 12:10 AM
ghane updated this revision to Diff 9880.Mar 15 2022, 12:47 AM

I'll just change line 22

import email.utils as rfc822

this keeps the history and intention of the code alive.

sicherha accepted this revision.Mar 16 2022, 10:22 PM
This revision is now accepted and ready to land.Mar 16 2022, 10:22 PM
This revision was automatically updated to reflect the committed changes.