Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 295042 - dev-python/pyzor-0.5.0-r1 fails when called from spamassassin: deprecation warnings
Summary: dev-python/pyzor-0.5.0-r1 fails when called from spamassassin: deprecation wa...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-29 13:36 UTC by Peter Gantner (a.k.a. nephros)
Modified: 2014-01-14 08:39 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
python26_warnings.patch (python26_warnings.patch,2.63 KB, text/plain)
2009-11-29 13:57 UTC, Peter Gantner (a.k.a. nephros)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Gantner (a.k.a. nephros) 2009-11-29 13:36:12 UTC
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
Comment 1 Peter Gantner (a.k.a. nephros) 2009-11-29 13:41:33 UTC
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
Comment 2 Peter Gantner (a.k.a. nephros) 2009-11-29 13:57:02 UTC
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.
Comment 3 Wormo (RETIRED) gentoo-dev 2009-12-02 07:19:53 UTC
Thanks for finding and posting the patch! Assigning to maintainers.
Comment 4 Peter Gantner (a.k.a. nephros) 2009-12-02 08:14:07 UTC
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.):
Comment 5 Massimiliano Ballerini 2010-06-07 21:52:06 UTC
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?
Comment 6 Forza 2010-10-24 06:11:36 UTC
This same problem with deprecation warnings also causes SpamAssassin to not load the Pyzor module:

spamd[1051]: pyzor: [1055] error: TERMINATED, signal 15 (000f)
Comment 7 Andreas Prieß 2010-11-12 00:08:49 UTC
Same problem here as described in comment #6
Comment 8 Peter Gantner (a.k.a. nephros) 2010-11-12 10:59:18 UTC
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.
Comment 9 Jeff Mitchell 2010-12-26 00:47:01 UTC
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...
Comment 10 Kostas Kavourakis 2011-02-21 19:18:14 UTC
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.
Comment 11 Hanno Böck gentoo-dev 2014-01-14 08:39:12 UTC
This is fixed in pyzor-0.5.0-r2, stabilization takes place in #498050