On 7/28/19 4:18 PM, Christian Schwarz wrote:
Most mailing lists can be imported successfully using the
import21subcommand, as described in the docs.
Some mailing lists fail with the following error:
sudo -u list mailman import21 REDACTEDLIST@example.org /var/lib/mailman/lists/REDACTEDLIST/config.pck Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/mailman/commands/cli_import.py", line 64, in import21 pickle_file, encoding='utf-8', errors='ignore') ModuleNotFoundError: No module named 'Mailman'
I know what's happening, but I need more detail to do more than guess at how to fix it.
The issue is there is a Mailman 2.1 Mailman.xxx.yyy object in the config.pck file. My best guess is that the list's bounce_info is the culprit.
The list's bounce_info is a dictionary with keys equal to member addresses and values equal to the Mailman.Bouncer._BounceInfo object representing that member's bounce info.
So when import21 calls pickle.load to load the config.pck, there is a reference to one or more Mailman.Bouncer._BounceInfo objects, but pickle.load can't find the definition of that object and that raises the exception.
As to how to proceed, there are a couple of ways. One is to fix import21 so it ignores this issue. I just reported https://gitlab.com/mailman/mailman/issues/618 on this, but I'm not sure how to fix it. I don't think it will work to try the pickle.load and pass the ModuleNotFoundError exception because I think the rest of the pickled data won't be returned.
It looks like you still have the MM 2.1 installation, so you could use either MM 2.1's bin/withlist or bin/config_list to set the list's bounce_info to an empty dictionary. and then use the updated config.pck for the import.
This assumes that bounce_info is the issue. You can verify that there is a non-empty bounce_info dictionary with either bin/withlist or bin/dumpdb.