“It's alive! It's alive!” Frankenstein, 1931

Cpanel – Mailman not working – Python Error

friend of mine uses Mailman to send out messages to his fans.  We recently moved him to a new server, with CentOS 6 and the latest Cpanel, but we found that a few things weren’t working.  Most of it related to his old code making use of a “feature” that was actually a bug, but we did find an issue with mailman that related to Cpanel’s old version of Python it uses for it’s scripts.

Cpanel’s official support page tells you you :

  • Update cPanel & WHM with the /scripts/upcp script.
  • Use the /script/fixmailman script to resolve common Mailman issues.
  • Use the /scripts/fixcommonproblems script to correct mailbox permissions, common mailman issues, CGI script issues, NDC and quota issues.
  • To reinstall Mailman, use the /usr/local/cpanel/bin/mailman-install --force command.
  • Mailman uses Python. If there is an issue with Python, reinstall Python with the /scripts/pythonup --force command.

But that did not work for me, in fact it gave me more errors :

 

Fixing mailman list urls.....Traceback (most recent call last):
 File "/usr/local/cpanel/bin/cp_mailman2", line 12, in ?
 import cPanel
 File "/usr/local/cpanel/lib/python2/cPanel.py", line 14, in ?
 import simplejson as json
ImportError: No module named simplejson

That is a little bit more information as to what my problem is. So I tried to install the module for python.  That is when I found out that Cpanel doesn’t use the system’s python to run its scripts.  (it uses python 2.4).

This is how I managed to fix the issue :

 

cd ~
wget https://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz#md5=af5e67a39ca3408563411d357e6d5e47
tar xzvf simplejson-2.0.9.tar.gz
cd simplejson-2.0.9
/usr/local/cpanel/3rdparty/bin/python setup.py install

And mailman started working again.  I had to grab an older version of  simplejson since cpanel is using an old version.

Posted in