Score:0

After mailman upgrade to mailman3, can't use CLI utilities: ImportError: No module named Mailman

ru flag

After walking down the garden path of reading the documentation, and being led astray - in particular, by the materials I found here - out of pure frustration I eventually found my way to the "official Wiki", which is here, and it pointed me to the "missing" Command Line Interface (CLI) utilities. They're found, on my installation, at /lib/mailman/bin. However, they don't work!

For example, running as user mailman:

$ add_members -h
Traceback (most recent call last):
  File "/lib/mailman/bin/add_members", line 89, in <module>
    from Mailman import i18n
ImportError: No module named Mailman

I'm sure someone will ask, so:

Fedora Server 32 running mailman3-3.2.2-1.fc32.noarch ...And some 153 or so Python3 packages... A python3 --version command says it's 3.8.5.

BTW, I used DNF to install Mailman3. I have no idea if I was supposed to install more than just that, but normally DNF will complain if there are unresolved dependencies and it didn't complain.

...I really need to get these working and am NOT a Python programmer, by any means. Nor do I really want to take the time to learn it now... Why mention that? Keep reading:

As a "bread-crumb" (as in the Hansel and Gretel folk tale) for those who might follow along later, from the documentation at the previously cited site, APPARENTLY, again, according to THAT source, you have to get into a Python shell, write your own Python functions and, in short, become a Python AND Mailman library expert just to use what they call a CLI interface. Crazy!

If going that route, you su to mailman (to get the right user context) then:

$ PYTHONSTARTUP= mailman3 shell

And you get a python prompt >>> and from there you have to do things like:

>>> from mailman.testing.documentation import cli
>>> command = cli('mailman.commands.cli_withlist.shell')
>>> command('mailman shell --details')

And, there's a LOT possible from here, All of which requires a lot of typing AND knowing Python far better than I presently do. There's documentation for this over here. ...All I really want to do is import a file containing people's names and email addresses saved from the previous version and add them to a list, but it's a LOT of typing to do that in this environment.

Happily, that all DOES work, best I could tell from my not-fully-informed attempts at trying it.

It should be "very easy" to write scripts that would emulate the older mailman 2.x utilities, so perhaps you can see how I was frustrated before I found the utilities STILL DO exist, they just don't work! ...I'm 100% sure I could learn Python and the mailman3 library and write my own, but I have no time for that. ...SO, I need to get these other utilities working.

Score:0
ru flag

I solved it through persistence. Following what I document here, I now have the command-line tools working properly and Mailman is functioning well enough, though I haven't got the web interface going yet. ...The first new list is both created and sending mails properly.

I decided that MAYBE I hadn't installed ENOUGH software, but didn't know what I might have missed, so I ran dnf again, as follows:

# dnf install mailman3*
Last metadata expiration check: 2:38:45 ago on Mon 31 Jan 2022 04:09:14 PM PST.
Package mailman-3:2.1.34-1.fc32.x86_64 is already installed.
Package mailman3-3.2.2-1.fc32.noarch is already installed.
Dependencies resolved.
================================================================================
 Package                      Arch       Version              Repository   Size
================================================================================
Installing:
 mailman3-fedmsg-plugin       noarch     0.5-14.fc32          fedora       21 k
Installing dependencies:
 fedmsg-base                  noarch     1.1.2-1.fc32         updates      22 k
 openpgm                      x86_64     5.2.122-22.fc32      fedora      189 k
 python3-Automat              noarch     20.2.0-1.fc32        fedora       65 k
 python3-arrow                noarch     0.14.6-3.fc32        fedora       82 k
 python3-constantly           noarch     15.1.0-9.fc32        fedora       20 k
 python3-daemon               noarch     2.2.3-8.fc32         fedora       38 k
 python3-docutils             noarch     0.15.2-4.fc32        fedora      1.5 M
 python3-fedmsg               noarch     1.1.2-1.fc32         updates     320 k
 python3-hamcrest             noarch     1.9.0-13.fc32        fedora       73 k
 python3-hyperlink            noarch     19.0.0-6.fc32        fedora       75 k
 python3-incremental          noarch     17.5.0-10.fc32       fedora       33 k
 python3-kitchen              noarch     1.2.6-5.fc32         fedora       88 k
 python3-lockfile             noarch     1:0.11.0-17.fc32     fedora       30 k
 python3-moksha-common        noarch     1.2.5-14.fc32        fedora       43 k
 python3-moksha-hub           noarch     1.5.17-6.fc32        fedora       76 k
 python3-psutil               x86_64     5.6.7-1.fc32         fedora      383 k
 python3-pyasn1-modules       noarch     0.4.8-1.fc32         fedora      211 k
 python3-stomper              noarch     0.4.3-6.fc32         fedora       49 k
 python3-twisted              x86_64     20.3.0-1.fc32        updates     6.0 M
 python3-txws                 noarch     0.9.1-20.fc32        updates      24 k
 python3-txzmq                noarch     0.8.0-13.fc32        fedora       47 k
 python3-zmq                  x86_64     18.1.0-3.fc32        fedora      412 k
 zeromq                       x86_64     4.3.3-1.fc32         updates     496 k
Installing weak dependencies:
 python3-service-identity     noarch     18.1.0-6.fc32        fedora       27 k

Transaction Summary
================================================================================
Install  25 Packages

Total download size: 10 M
Installed size: 49 M
Is this ok [y/N]:
...etc...

One effect of this was to disable mailman3, so I re-enabled it and restarted it with systemctl. It also wiped out the previous list (I was able to create but not populate a list as things were before), so I had to make a list called mailman first - as I recall it wouldn't successfully start without that. But with the new mailman email list created, THEN mailman3 would start and I then created my new mailing list.

I hadn't expected it to re-install Mailman3, and I'm guessing it did because it reset the service to disabled. ...So it's POSSIBLE the master list was wiped out because I hadn't stoped the still running mailman3.server service.

UNLIKE the previous 2.x of Mailman, I had to manually add the new list aliases to /etc/aliases and then run postalias and restart postfix to have them take effect - a rather annoying step backwards?! But, hey, it worked.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.