the pyzor script uses some deprecated modules and python warnings about them. This confuses spamassassin when called from command line. The same problem was solved over there https://bugs.launchpad.net/ubuntu/jaunty/+source/pyzor/+bug/394775 by using #!/usr/bin/python -Wignore::DeprecationWarning in the pyzor script. Reproducible: Always Steps to Reproduce: 1. Test pyzor & spamassassin thusly: echo "test" | spamassassin -D pyzor 2>&1 | less Actual Results: [16270] dbg: pyzor: network tests on, attempting Pyzor [16270] dbg: pyzor: pyzor is available: /usr/bin/pyzor [16270] dbg: pyzor: opening pipe: /usr/bin/pyzor --homedir /etc/mail/spamassassin check < /tmp/.spamassassin16270lMZaOttmp [16270] dbg: pyzor: [16275] finished: exit=0x0100 [16270] dbg: pyzor: got response: /usr/lib/python2.6/site-packages/pyzor/__init__.py:11: DeprecationWarning: the sha module is deprecated; use the hashlib module instead\n import sha\n/usr/lib/python2.6/site-packages/pyzor/client.py:12: DeprecationWarning: the multifile module has been deprecated since Python 2.5\n import multifile [16270] dbg: pyzor: failure to parse response "/usr/lib/python2.6/site-packages/pyzor/__init__.py:11: DeprecationWarning: the sha module is deprecated; use the hashlib module instead" [16270] dbg: pyzor: failure to parse response " import sha" [16270] dbg: pyzor: failure to parse response "/usr/lib/python2.6/site-packages/pyzor/client.py:12: DeprecationWarning: the multifile module has been deprecated since Python 2.5" [16270] dbg: pyzor: failure to parse response " import multifile" Received: from localhost by chalice.crownest.nephros.org with SpamAssassin (version 3.2.1-gr1); Expected Results: pyzor output should be clean enough to be useful to other tools. dev-lang/python-2.6.2-r1 dev-python/pyzor-0.5.0-r1 mail-filter/spamassassin-3.2.1-r1
Ubuntu fix it by using the recommended modules with this patch: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/karmic/pyzor/karmic/annotate/head%3A/debian/patches/01-python26_warnings.patch
Created attachment 211519 [details] python26_warnings.patch modified patch from #1 in addition to sha -> hashlib replaced multifile with email as per http://www.python.org/dev/peps/pep-0004/ does away with the warnings, seems to work with SA. Not extensively tested.
Thanks for finding and posting the patch! Assigning to maintainers.
Thanks. And while we're at it, maybe tackle this: pyzor ping /usr/lib/python2.6/site-packages/pyzor/__init__.py:429: DeprecationWarning: object.__init__() takes no parameters super(ThreadId, self).__init__(i) with this --- __init__.py.orig 2009-11-29 14:52:51.000000000 +0100 +++ __init__.py 2009-12-02 09:05:39.000000000 +0100 @@ -426,7 +426,6 @@ error_value = 0 def __init__(self, i): - super(ThreadId, self).__init__(i) if not (self.full_range[0] <= self < self.full_range[1]): raise ValueError, "value outside of range" (FULL DISCLOSURE: I do NOT speak python, I got the impression on the web that super() magic like this is not needed - I have almost no idea what the above change does.):
This problems is still present in last version of pyzor available in portage. I don't speak python either, but found this patch in another site: --- __init__.py.orig 2009-11-29 14:52:51.000000000 +0100 +++ __init__.py 2009-12-02 09:05:39.000000000 +0100 @@ -426,7 +426,6 @@ error_value = 0 def __init__(self, i): - super(ThreadId, self).__init__(i) + int.__init__(self) if not (self.full_range[0] <= self < self.full_range[1]): raise ValueError, "value outside of range" looks like it works now. Still have a problem with multifile substitute email tho: the code was fixed for the hashlib part, but not with the multifile module references. In fact pyzor fail when there are attachments. Error below: Traceback (most recent call last): File "/usr/bin/pyzor-2.6", line 8, in <module> pyzor.client.run() File "/usr/lib/python2.6/site-packages/pyzor/client.py", line 1022, in run ExecCall().run() File "/usr/lib/python2.6/site-packages/pyzor/client.py", line 205, in run if not apply(dispatch, (self, args)): File "/usr/lib/python2.6/site-packages/pyzor/client.py", line 281, in check for digest in get_input_handler(sys.stdin, self.digest_spec, do_mbox): File "/usr/lib/python2.6/site-packages/pyzor/client.py", line 648, in get_input_handler (DataDigester(rfc822BodyCleaner(fp), File "/usr/lib/python2.6/site-packages/pyzor/client.py", line 751, in __init__\n except (TypeError, AttributeError, multifile.Error): NameError: global name 'multifile' is not defined Of course now multifile is not defined! As I see email module has really different syntax and maybe this code need some restyle... Any idea?
This same problem with deprecation warnings also causes SpamAssassin to not load the Pyzor module: spamd[1051]: pyzor: [1055] error: TERMINATED, signal 15 (000f)
Same problem here as described in comment #6
As a very dirty quick fix, you can put this at the top of client.py: import warnings warnings.filterwarnings("ignore") and reintroduce the import mutifile line.
Just wanted to add my voice that patches put into Portage proper to fix this would be nice; as it is it's basically unusable for SA, which is probably by far the largest userbase for Pyzor...
One year+ later this is still open... gentoo is really low on devs. At least using the advices/patches found in this bug I got pyzor to work again.
This is fixed in pyzor-0.5.0-r2, stabilization takes place in #498050