My Dinky Note

Aditya Arie Nugraha's weblog

md5 Module Problem on mod_python

with 3 comments

I got this error message in my /var/log/apache2/error.log:

[Fri Aug 14 10:16:51 2009] [error] /usr/lib/python2.6/dist-packages/mod_python/ DeprecationWarning: the md5 module is deprecated; use hashlib instead
[Fri Aug 14 10:16:51 2009] [error]   import md5

I had tried upgrade the libapache2-mod-python package from 3.3.1-6build2 (jaunty package) to 3.3.1-7 (karmic package), but it wasn’t solve the problem.

So, the solution is edit /usr/lib/python2.6/dist-packages/mod_python/ Change import md5 to from hashlib import md5 and also to md5(file).hexdigest().


Written by arie

August 14, 2009 at 10:44 am

Posted in Hobbies & Interests

Tagged with , ,

3 Responses

Subscribe to comments with RSS.

  1. This is only a “DeprecationWarning”. Yes, it means that this module will disappear in the future, but, as it’s a widely used one, I probably won’t happen too soon. On the other hand, the mod_python developers are certainly aware about this deprecation and will issue a fix as necessary.

    I personally do not like to fiddle in code that was installed through a distribution package (as most likely with the case of mod_python).

    An alternative solution would be to create a new module called “md5” and make sure it’s in the search path /before/ the “original” md5 package. Then make this wrap “hashlib”. Be sure to forward any unknown method calls to the old md5 package and you should be good to go.

    However, this seems badly hackish and will likely break other apps. So, as I stated in the beginning, you should be fine by simply ignoring the warning. In general, package maintainers will be aware that there will be a problem in the future and it’s their job to keep the packages un-broken.

    mod_python is too important for too many people. It won’t break if you keep to the distribution packages. If you hand-compiled packages and did some manual dependency resolution then there may be trouble up ahead. The chance is still small though.

    In summary: I would advise /against/ changing code in /usr/lib/python2.6/dist-packages/mod_python/


    August 14, 2009 at 6:58 pm

  2. Who would have known about this blog.

    Internet Marketing

    February 15, 2012 at 4:18 pm

  3. Howdy! This post couldn’t be written any better! Reading through this post reminds me of my good old room mate! He always kept chatting about this. I will forward this post to him. Pretty sure he will have a good read. Many thanks for sharing!
    sos datenrettung

    sos datenrettung

    August 8, 2014 at 4:06 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: