Error Running Mailman's sync_members Print

  • 0

Symptoms

Attempting to import an email list using the /usr/local/cpanel/3rdparty/mailman/bin/sync_members binary results in an error like the following. 

[root@server ~]# /usr/local/cpanel/3rdparty/mailman/bin/sync_members -f emails.txt list_domain.tld
Traceback (most recent call last):
  File "/usr/local/cpanel/3rdparty/mailman/bin/sync_members", line 291, in <module>
    main()
  File "/usr/local/cpanel/3rdparty/mailman/bin/sync_members", line 240, in main
    elif not matches.has_key(laddr):
AttributeError: 'dict' object has no attribute 'has_key'

 

Description

With the update to Python 3 for Mailman, the usage of has_key() has been deprecated and removed. This will need to be updated to use the correct syntax for Python 3.

We've opened an internal case for our development team to investigate this further. For reference, the case number is CPANEL-51019. Follow this article to receive an email notification when a solution is published in the product. 

 

Workaround

The sync_members binary can be temporarily patched until a fix is released. 

sed -i 's/matches.has_key(laddr)/laddr in matches/g' /usr/local/cpanel/3rdparty/mailman/bin/sync_members

Please note that this command must be ran as the root user via SSH. Furthermore, please note that this file is controlled by the cpanel-mailman package. Any updates to this package will result in the patch being undone. 

Alternatively, you can use Mailman's list_members and add_members binaries to add any missing members to your mailing list. 


Was this answer helpful?
Back