[Spambayes] Compiling sb_filter on Win32

manoj.ku manoj.ku at directi.com
Fri Jan 12 11:31:05 CET 2007


Hi Tony,

I've been trying to do exactly the same thing as Joshua was in this 
thread 
(http://mail.python.org/pipermail/spambayes/2004-October/015033.html), 
to compile sb_filter.py into an exe on Win32. I have Python 2.5 
installed and my setup script is in a file called setupsb_filter.py :

from distutils.core import setup
import py2exe

setup(console=['sb_filter.py'])

When I run
    python setupsb_filter.py py2exe
I get a similar message saying that some of the following modules appear 
to be missing. The missing modules include email.Errors, 
email.Generator, email.Message, email.Parser, email.Utils, among others.

When i run the resulting sb_filter.exe from the dist directory, I get an 
error saying

Traceback (most recent call last):
    File "sb_filter.py", line 83, in <module>
    File "spambayes\hammie.pyc", line 4, in <module>
    File "spambayes\mboxutils.pyc", line 27, in <module>
    File "mailbox.pyc", line 1294, in <module>
    File "email\__init__.pyc", line 79, in __getattr__
    File "email\message.pyc", line 86, in <module>
    File "email\message.pyc", line 784, in Message
    File "email\__init__.pyc", line 79, in __getattr__
ImportError: No module named iterators.

Any ideas on how i can fix the exe?

Thanks,
Manoj Ku.
> >/ Anybody had any luck compiling sb_filter.py into an exe on 
> />/ Win32?  I keep seeing these error messages about certain 
> />/ modules not being found.
> /
> These don't necessarily matter, depending on what you're doing.  You can set
> py2exe to ignore them, if you like.
>
> Have you tested the resulting .exe?  Does it work?  If not, what happens?
>
> >/ The following modules 
> />/ appear to be missing ['MySQLdb', 'bsddb3', 'gdbm', 'psycopg', 
> />/ 'win32com.shell']
> /
> You only need MySQLdb if you want the sb_filter.exe to be able to use MySQl
> as a storage option.  If you do, then you need to install MySQLdb and py2exe
> will find it.  If you don't, then this error is harmless.
>
> You don't need bsddb3 since you're compiling with Python 2.3.  py2exe's
> modulefinder isn't clever enough to understand that it only gets loaded with
> earlier versions of Python.  This error is harmless, and you can ignore it,
> or set py2exe to ignore it.
>
> AFAIK gdbm isn't used on Windows.  IAC, it's just another storage option
> like MySQLdb, so unless you're planning on explicitly using it, again it's
> harmless.
>
> pyscopg is for using Postgre SQL I think (but am not 100%).  If I'm right,
> then that's just like MySQL, above.
>
> I don't know what is asking for win32com.shell, but I suspect that it's for
> the Options, as, on Windows, the Options code looks for the
> bayescustomize.ini file in the Windows Application Data directory, which it
> needs pywin32 to find.  If you don't have this, I'm pretty sure the code
> falls back to the non-Windows behaviour, so again harmless, or you can
> install pywin32 and that should let py2exe find it.
>
> =Tony Meyer


More information about the SpamBayes mailing list