delphij's Chaos

选择chaos这个词是因为~~实在很难找到一个更合适的词来形容这儿了……

03 Nov 2009

PlanetPlanet vs Python 2.6

On Python 2.6 we have a new ‘hashlib’ module, which superseded older ‘md5’ ‘sha1’ modules.

Therefore, importing ‘md5’ would give the following warnings:

DeprecationWarning: the md5 module is deprecated; use hashlib instead

This is quite annoying if you run PlanetPlanet in a cron(8) job and receive e-mail reports. In order to solve that, we can do some simple sed(1) replace over PlanetPlanet’s __init__.py:

s/import md5/import hashlib/g

s/md5\.new/hashlib.md5/g

That’s it! And PlanetPlanet will now happily work with Python 2.6.


Archived: 1 Comment

Yue Wang | November 5, 2009 1:33 AM

老大最近开始科普了?