On Tue, Oct 19, 2010 at 2:30 PM, Tasmanian Devil
<[email protected]> wrote:
> Hello, list!
>
> Since the upgrade to Python 2.6 sysutils/tentakel shows these warnings
> above the usual output:
>
>
> /usr/local/lib/python2.6/site-packages/lekatnet/config.py:55:
> DeprecationWarning: The popen2 module is deprecated. Use the
> subprocess module.
> import popen2
> /usr/local/lib/python2.6/site-packages/lekatnet/plugins/rsh.py:29:
> DeprecationWarning: the md5 module is deprecated; use hashlib instead
> import md5
>
>
> So I searched a bit on the web and found a way to suppress these
> warnings. I don't know anything about Python unfortunately, so my
> patch might not be correct or the location where I add the code
> (config.py) might be wrong, but so far it works just fine for me.
You're only suppressing the warnings, not fixing the code in the right way.
For md5 is simple:
try:
from hashlib import md5
except ImportError:
from md5 import new as md5
Replacing popen2.popen3 with subprocess.Popen is a little more
complicated, but it's full of examples out there...
ciao,
david