Deprecation Warnings when running under Python 2.6

Bug #363877 reported by François Marier
14
Affects Status Importance Assigned to Milestone
python-boto (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: duplicity

This is what I get everytime I run duplicity:

/var/lib/python-support/python2.6/boto/utils.py:42: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
/var/lib/python-support/python2.6/boto/utils.py:45: DeprecationWarning: The popen2 module is deprecated. Use the subprocess module.
  import popen2, os, StringIO
/var/lib/python-support/python2.6/boto/s3/key.py:23: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5
/var/lib/python-support/python2.6/boto/utils.py:42: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
/var/lib/python-support/python2.6/boto/utils.py:45: DeprecationWarning: The popen2 module is deprecated. Use the subprocess module.
  import popen2, os, StringIO
/var/lib/python-support/python2.6/boto/s3/key.py:23: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5
/var/lib/python-support/python2.6/boto/utils.py:42: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
/var/lib/python-support/python2.6/boto/utils.py:45: DeprecationWarning: The popen2 module is deprecated. Use the subprocess module.
  import popen2, os, StringIO
/var/lib/python-support/python2.6/boto/s3/key.py:23: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5

I run duplicity from a cron job, so this is making it very hard for me to monitor whether or not backup worked. Is there an easy way to filter out or disable these DeprecationWarnings?

I tried "duplicity ... | grep -v "DeprecationWarning" 2>&1" but that didn't work...

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

This was fixed in duplicity 0.5.06 and the current version is 0.5.15. Please go to http://duplicity.nongnu.org/ and install the newest version.

Revision history for this message
François Marier (fmarier) wrote :

The version that's in Ubuntu Jaunty is 0.5.09 and is affected by this problem.

Are you sure it got fixed in 0.5.06?

Revision history for this message
François Marier (fmarier) wrote :

According to http://sc.tamu.edu/help/general/unix/redirection.html it looks like the I should be using this syntax:

  duplicity ... 2>&1| grep -v "DeprecationWarning"

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Yes. I double checked in CVS. The following code was added to gpg.py in 0.5.06 and has not changed since:

try:
    from hashlib import sha1
    from hashlib import md5
except ImportError:
    from sha import new as sha1
    from md5 import new as md5

So unless hashlib is missing from your system, it should be using hashlib.

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Sorry, the traceback is referring to boto, not duplicity. Different project. I think it may be fixed in newer versions of boto.

Revision history for this message
Daniel Hahler (blueyed) wrote :

I'm assigning the bug to (python-)boto.
Prio "Low" since it's only a warning (although it's spammy - but can be worked around).

affects: duplicity (Ubuntu) → python-boto (Ubuntu)
Changed in python-boto (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Daniel Hahler (blueyed) wrote :

popen2 still gets used in 1.6b (latest package in Debian unstable) (from looking at the code only).
But it appears to be fixed in the 1.7a release (http://code.google.com/p/boto/source/browse/tags/1.7a/boto/utils.py).

Revision history for this message
Daniel Hahler (blueyed) wrote :

JFI: As a workaround, this may filter out the warnings (add it to the top of e.g. utils.py):
  import warnings
  warnings.simplefilter("ignore", DeprecationWarning)

Revision history for this message
François Marier (fmarier) wrote :

Thanks Daniel. I have filed a "new upstream release" bug against the Debian package.

I have also used your work-around in /usr/share/pyshared/duplicity/backends/botobackend.py and it works fine.

(This could be an easy way to resolve the issue in the Jaunty duplicity package actually...)

Revision history for this message
Scott Moser (smoser) wrote :

Based on the comments above, this bug should have been fixed in boto 1.7. We're at boto 1.8 in Karmic and 1.9 in Lucid. Given that, I'm closing as fix released. Please re-open if this is still a problem on 9.10 or 10.04.

Changed in python-boto (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.