import21: ModuleNotFoundError: No module named 'Mailman'
Hi,
I am migrating a Mailman 2.1 setup to Mailman 3 (Debian Buster).
Most mailing lists can be imported successfully using the import21
subcommand, 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/bin/mailman", line 11, in <module> load_entry_point('mailman==3.2.1', 'console_scripts', 'mailman')() File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/mailman/bin/mailman.py", line 69, in invoke return super().invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) 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'
Note again: most mailing lists of the installation work fine. And this particular pck file is fairly recently modified.
Has this happened before? Any suggestions how to debug this?
Thanks,
Christian
On 7/28/19 4:18 PM, Christian Schwarz wrote:
Most mailing lists can be imported successfully using the
import21
subcommand, as described in the docs.
Good.
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.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Sun, 2019-07-28 at 17:07 -0700, Mark Sapiro wrote:
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.
Indeed, bounce_info is not empty!
I think I need more precise instructions on how to empty bounce_info using config_list, though.
On Mon, 2019-07-29 at 03:00 +0200, Christian Schwarz wrote:
I think I need more precise instructions on how to empty bounce_info using config_list, though.
Nvmd, figured it out:
echo 'bounce_info = {}' > /tmp/reset_bounceinfo.py config_list --checkonly -i /tmp/reset_bounceinfo.py && config_list -i /tmp/reset_bounceinfo.py
It seems to work, import is ongoing!
Thanks for helping out!
participants (2)
-
Christian Schwarz
-
Mark Sapiro