Page 1 of 1

ImportError: No module named message

Posted: May 1st, 2010, 3:38 am
by Tuurbo
Version: 0.5.2 RC1
OS: CentOS 5.4
Install-type: OSx source
Python version: Python 2.4.3
Firewall Software: None
Are you using IPV6? No
Is the issue reproducible? Yes

I'm running SABnzbd 0.5.0 smoothly on my CentOS system. Problem is when I want to upgrade to 0.5.2 RC1 is get this error;

Code: Select all

Traceback (most recent call last):
  File "/usr/share/SABnzbd/SABnzbd.py", line 63, in ?
    import sabnzbd
  File "/usr/share/SABnzbd/sabnzbd/__init__.py", line 66, in ?
    import sabnzbd.nzbqueue as nzbqueue
  File "/usr/share/SABnzbd/sabnzbd/nzbqueue.py", line 37, in ?
    import sabnzbd.assembler
  File "/usr/share/SABnzbd/sabnzbd/assembler.py", line 40, in ?
    import sabnzbd.postproc
  File "/usr/share/SABnzbd/sabnzbd/postproc.py", line 41, in ?
    import sabnzbd.emailer as emailer
  File "/usr/share/SABnzbd/sabnzbd/emailer.py", line 212, in ?
    from email.message import Message
ImportError: No module named message
I'm starting SAB by commandline

Code: Select all

python /usr/share/SABnzbd/SABnzbd.py -s 192.168.0.3:8001 -f sabnzbd.ini --browser 0 -d
Has anybody got an idea what's going wrong?

Re: ImportError: No module named message

Posted: May 1st, 2010, 3:48 am
by shypike
Did you install the new version over the old one?
Don't do that!
Remove the file email.py from the installation.

Re: ImportError: No module named message

Posted: May 1st, 2010, 4:09 am
by Tuurbo
I always remove the complete SABnzbd directory and place a new one.
I check just to be sure, but there's no file 'email.py' present.

[UPDATE]
If I copy the email.py from 0.5.0 to 0.5.2 RC1 and rename it to emailer.py the error message is gone.

The main diffence between the old (email.py) and new (emailer.py) file i could quickly detect is around line 212:

Code: Select all

from email.message import Message
from email.header import Header
from email.encoders import encode_quopri
RE_HEADER = re.compile(r'^([^:]+):(.*)')
Could it be that my Python isn't configured correct?

Re: ImportError: No module named message

Posted: May 1st, 2010, 8:00 am
by shypike
Either the email.py file is hiding the standard Python email module
or your Python misses the email module altogether.
Using the old email module is not a good idea.

Re: ImportError: No module named message

Posted: May 3rd, 2010, 12:50 pm
by lordmatanza
I'm having the same problem and have no clue how to fix it.

I'm running CentOS 5.4

Re: ImportError: No module named message

Posted: May 3rd, 2010, 1:26 pm
by Tuurbo
I've try'd to solve the problem, but was unsuccessful.

Now back to SABnzbd version 0.5.0

Re: ImportError: No module named message

Posted: May 3rd, 2010, 3:46 pm
by shypike
The cause is that we don't test on Python 2.4 anymore.
The email library in 2.4 is a bit different.

I cannot guarantee that email still functions, but you can edit the file emailer.py.
Changes these lines:

Code: Select all

from email.message import Message
from email.header import Header
from email.encoders import encode_quopri
to

Code: Select all

from email.Message import Message
from email.Header import Header
from email.Encoders import encode_quopri
At least SABnzbd will now startup.

I find it hard to take an OS like CentOS serious.
Python 2.5 was released end of 2006.
We're talking about a mainstream OS, not some specialty embedded device.

Re: ImportError: No module named message

Posted: May 4th, 2010, 3:18 am
by lordmatanza
That did it...

I know about the 'age' of CentOS and I agree that it's shamefull that it still uses python 2.4, but the main advantage why I use it is that it's super stable and extremely well tested (it's basically RHEL).
I used to use Fedora, but got sick of installing my machine every 13 months because the life cycle ended.
But this is a whole other discussion not for this forum ;)

Thnx for you help!

Re: ImportError: No module named message

Posted: May 4th, 2010, 4:24 am
by shypike
It's probably fixable.
The differences cannot be very big, because it's only some email classes.
As soon as I have a VMWare session with Python 2.4 running, it should be easy to check.
At some point we will need to drop Python 2.4 and 2.5, because they keep us
from migrating to a full Unicode app.

Re: ImportError: No module named message

Posted: May 4th, 2010, 12:11 pm
by shypike
The fix is indeed trivial.
Just download the attachment of this announcement: http://forums.sabnzbd.org/http://forums ... 782#p30782

Re: ImportError: No module named message

Posted: May 4th, 2010, 1:04 pm
by Tuurbo
It works! :)

Wanted to thank you for the extra service for we Python 2.4 users. Maybe i'll switch in the future to an other distro, but that's an other discussion.

This topic can be locked.

Re: ImportError: No module named message

Posted: May 4th, 2010, 2:31 pm
by Bascy
Just installed 0.5.2 on Freenas with Python 25 installed and having the same problems!

Will try the fix from the other thread, but just wanted to let you know that it also exists in python 2.5

Edit: Installed the fix, but still the same error. Although i am a progammer, I'v never done anything with python ... but i'll try to fix this

I got the following python packages installed ... am i missing something?

Code: Select all

py25-chardet-1.0.1  Character encoding auto-detection in Python
py25-cheetah-2.0.1  HTML template engine for Python
py25-cherrypy-3.1.1 A pythonic, object-oriented web development framework
py25-elementtree-1.2.6 Container for hierarchical data structures written in Pytho
py25-feedparser-4.1_2 An RSS feed parser written in Python
py25-openssl-0.8_1  Python interface to the OpenSSL library
py25-setuptools-0.6c9 Download, build, install, upgrade, and uninstall Python pac
py25-sqlite3-2.5.4_1 Standard Python binding to the SQLite3 library
py25-utils-0.3.0    General utility modules that simplify common programming in
python25-2.5.4_1    An interpreted object-oriented programming language

Re: ImportError: No module named message

Posted: May 4th, 2010, 2:59 pm
by shypike
You did not install release 0.5.2Final over any old version, did you?
If so, remove the file sabnzbd/email.py

Otherwise you have a lousy Python on your system.

Re: ImportError: No module named message

Posted: May 4th, 2010, 3:26 pm
by Bascy
Yep, that was the problem.

I did try installing Python 2.6 but couldnt find all the packages needed. Have they changed all that in 2.6?

Re: ImportError: No module named message

Posted: May 4th, 2010, 4:26 pm
by shypike
The email modules should be included in each standard source distribution.
SABnzbd works fine with a properly installed Python 2.6.
The only required third-party module is Cheetah.
PyOpenSSL and yEnc are optional (but I wouldn't leave out yEnc).