Alternative Python bindings for Subversion

DeprecationWarning: the md5 module is deprecated; use hashlib instead

Reported by Ronald Blaschke on 2009-01-30
36
This bug affects 4 people
Affects Status Importance Assigned to Milestone
subvertpy
Low
Jelmer Vernooij
subvertpy (Ubuntu)
Low
Unassigned

Bug Description

Using Python 2.6:

...Lib\site-packages\subvertpy\delta.py:21: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5

Jelmer Vernooij (jelmer) wrote :

I don't have 2.6 yet, so I can't test fixes for this. I'll commit one when I do.

Changed in subvertpy:
assignee: nobody → jelmer
importance: Undecided → Low
status: New → Triaged
Ronald Blaschke (rblasch) wrote :

Not exactly sure, but I think hashlib is already available in 2.5, it's just that md5 is deprecated with 2.6. Here's what I did for my 2.6 install (the warning is just too annoying.)

=== modified file 'subvertpy/delta.py'
--- subvertpy/delta.py 2009-01-28 01:36:28 +0000
+++ subvertpy/delta.py 2009-01-30 18:56:10 +0000
@@ -18,7 +18,7 @@
 __author__ = "Jelmer Vernooij <email address hidden>"
 __docformat__ = "restructuredText"

-import md5
+import hashlib

 TXDELTA_SOURCE = 0
 TXDELTA_TARGET = 1
@@ -77,7 +77,7 @@
     :param handler: txdelta window handler function
     :return: MD5 hash over the stream
     """
- hash = md5.new()
+ hash = hashlib.md5()
     text = stream.read(block_size)
     while text != "":
         hash.update(text)

On Fri, 2009-01-30 at 19:00 +0000, Ronald Blaschke wrote:
> Not exactly sure, but I think hashlib is already available in 2.5, it's
> just that md5 is deprecated with 2.6. Here's what I did for my 2.6
> install (the warning is just too annoying.)
It's not available in python2.4 though, and we need it to work there
too. Does:

import hashlib

hashlib.md5.new()

work ?
--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

Ronald Blaschke (rblasch) wrote :

Jelmer Vernooij wrote:
> On Fri, 2009-01-30 at 19:00 +0000, Ronald Blaschke wrote:
>> Not exactly sure, but I think hashlib is already available in 2.5, it's
>> just that md5 is deprecated with 2.6. Here's what I did for my 2.6
>> install (the warning is just too annoying.)
> It's not available in python2.4 though, and we need it to work there
> too. Does:
>
> import hashlib
>
> hashlib.md5.new()
>
> work ?

I'm sorry, no.

Traceback (most recent call last):
  File "t.py", line 3, in <module>
    hashlib.md5.new()
AttributeError: 'builtin_function_or_method' object has no attribute 'new'

I've seen two ways to handle the situation for 2.4. Either an explict
version check (e.g. bzrlib/osutils.py) or fallback handling (e.g.
http://hg.stuvel.eu/flickrapi/rev/c96a2d1288ef).

But if you don't use 2.6 please feel free to put the issue aside for
now. I don't mind the local changes I've made. But I hope it's okay if
I report 2.6 issues/warnings still.

Ron

On Fri, 2009-01-30 at 19:45 +0000, Ronald Blaschke wrote:
> Jelmer Vernooij wrote:
> > On Fri, 2009-01-30 at 19:00 +0000, Ronald Blaschke wrote:
> >> Not exactly sure, but I think hashlib is already available in 2.5, it's
> >> just that md5 is deprecated with 2.6. Here's what I did for my 2.6
> >> install (the warning is just too annoying.)
> > It's not available in python2.4 though, and we need it to work there
> > too. Does:
> >
> > import hashlib
> >
> > hashlib.md5.new()
> >
> > work ?
>
> I'm sorry, no.
>
> Traceback (most recent call last):
> File "t.py", line 3, in <module>
> hashlib.md5.new()
> AttributeError: 'builtin_function_or_method' object has no attribute 'new'
>
> I've seen two ways to handle the situation for 2.4. Either an explict
> version check (e.g. bzrlib/osutils.py) or fallback handling (e.g.
> http://hg.stuvel.eu/flickrapi/rev/c96a2d1288ef).
I guess I'll have a look at doing the version check similar to osutils.

> But if you don't use 2.6 please feel free to put the issue aside for
> now. I don't mind the local changes I've made. But I hope it's okay if
> I report 2.6 issues/warnings still.
Yeah, please keep reporting them. it's much appreciated.

Cheers,

Jelmer
--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

  status fixreleased
--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

Changed in subvertpy:
status: Triaged → Fix Released
William Grant (wgrant) on 2009-03-08
Changed in subvertpy:
importance: Undecided → Low
status: New → Triaged
vroetman (vroetman) wrote :

This is still a problem in jaunty.

vroetman (vroetman) wrote :

It appears to be fixed in Jaunty in the latest update.

Tobias Stegmann (punischdude) wrote :

No it is not fixed in Jaunty.

I walked into this issue 10 minutes ago with all updates installed.

Jelmer Vernooij (jelmer) wrote :

fwiw this is fixed in the version in debian Sid.

In Jaunty updated Wed Mar 25, 2009 "twisted" also uses the md5 module instead of hashlib.

$ landscape-sysinfo > /dev/null
/usr/lib/python2.6/dist-packages/twisted/internet/_sslverify.py:5: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import itertools, md5
/usr/lib/python2.6/dist-packages/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha

Slug (neilbyrne) wrote :

I have this problem in Jaunty while running hellanzb - all updates install

 $hellanzb
/usr/lib/python2.6/dist-packages/twisted/internet/_sslverify.py:5: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import itertools, md5
Xlib: extension "Generic Event Extension" missing on display "localhost:0.0".
^CXlib: extension "Generic Event Extension" missing on display "localhost:0.0".
Xlib: extension "Generic Event Extension" missing on display "localhost:0.0".
Xlib: extension "Generic Event Extension" missing on display "localhost:0.0".
/usr/lib/python2.6/dist-packages/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
/var/lib/python-support/python2.6/Hellanzb/Util.py:33: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  self.message = message

Gabriele Monti (psicus78) wrote :

Patch to fix this bug

Slug (neilbyrne) wrote :

sorry to sound daft but which file do i edit for this patch?

Jelmer Vernooij (jelmer) wrote :

please sync from Debian instead; subvertpy 0.6.5 contains a fix for this and several other bugs, including some segfaults and a large memory leak.

Slug (neilbyrne) wrote :

how do i do that?

Slug (neilbyrne) wrote :

I added
deb http://ftp.us.debian.org/debian/ stable main non-free contrib
to my sources.list did a update and noticed an updated version of hellanzb was available - installed this and still have the same problem,

/usr/lib/python2.6/dist-packages/twisted/internet/_sslverify.py:5: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import itertools, md5

/usr/lib/python2.6/dist-packages/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha
/var/lib/python-support/python2.6/Hellanzb/Util.py:33: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  self.message = message

hella will then download one file and stop - leaving the nzb in daemon.current which it will then download the same data again once run

Jelmer Vernooij (jelmer) wrote :

Slug, this bug is about *subvertpy* not about twisted or hellanzb. Please file a separate bug for those.

Syncs usually are done from Debian unstable or experimental, not from stable.

Slug (neilbyrne) wrote :

ahh sorry I've been hoppin about a bit

Scott Kitterman (kitterman) wrote :

Uploaded. Thank you for your contribution to Ubuntu.

The debdiff did lack the maintainer change, but I fixed that before upload.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package subvertpy - 0.6.1-1ubuntu1

---------------
subvertpy (0.6.1-1ubuntu1) jaunty; urgency=low

  * subvertpy/delta.py: apply revision 2016 from upstream to fix python2.6
    deprecation (LP: #323270)

 -- Gabriele Monti <email address hidden> Fri, 03 Apr 2009 13:33:44 +0200

Changed in subvertpy (Ubuntu):
status: Triaged → Fix Released
Leo (leorolla) wrote :

I am experiencing this on a fresh Karmic install.

r33d (sealfoss) wrote :

I am experiencing this on a fresh Karmic install also.

Slug (neilbyrne) wrote :

use sabnzbdplus - it is much - much better !

http://sabnzbd.org/

positivek (anonyhole) wrote :

Hello,
I am using Rubber v1.1. When I use it, I get this error

user@machname:~$ rubber --version
/usr/share/rubber/rubber/util.py:8: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5
Rubber version: 1.1
module path: /usr/share/rubber
user@machname:~$

I have no idea why, but it seems that this bug is not fixed. I'm on
Xubuntu 9.10, Karmic.
Linux machname 2.6.31-22-generic #65-Ubuntu SMP Thu Sep 16 16:21:34 UTC 2010 x86_64 GNU/Linux

positivek (anonyhole) wrote :

Sorry, maybe that was meant for bug 338285.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers