Re: ImportError: No module named _md5 - please help

Discussion in 'Python' started by Falcolas, Oct 29, 2009.

  1. Falcolas

    Falcolas Guest

    On Oct 29, 9:13 am, user7304 <> wrote:
    > Hi,
    >
    > I am trying to run a python script and got this error.
    >
    > >>import _md5
    > >>ImportError: No module named _md5

    >
    > Googling the problem suggested that I install the 'py25-hashlib'.
    >
    > the following does not work for me 'sudo port install py25-hashlib' ,
    > trying to install MacPorts raised many problems.
    >
    > My question is: any idea on how to install it using yum?
    > I am running python 2.6.2 on a centos machine.
    >
    > Many thanks for your help.


    Try using hashlib.md5. From the docs:

    >>> import hashlib
    >>> m = hashlib.md5()
    >>> m.update("Nobody inspects")
    >>> m.update(" the spammish repetition")
    >>> m.digest()

    '\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

    http://www.python.org/doc/2.5.2/lib/module-hashlib.html

    Garrick
     
    Falcolas, Oct 29, 2009
    #1
    1. Advertising

  2. Falcolas

    Robert Kern Guest

    On 2009-10-29 11:39 AM, wadi wadi wrote:
    > Hi Garrick,
    >
    > My python script depends on another framework that is implemented in python.
    > The error is originating from the framework code note my script and I
    > cannot change the framework.
    >
    > Also, it works on other machines. So my guess is that I have no choice I
    > need to install the 'py25-hashlib' on my current box.
    > Any idea?


    py25-hashlib is the name of a MacPorts package. That's for Macs, not Centos.

    hashlib is part of the standard library. You have a broken Python installation.

    --
    Robert Kern

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco
     
    Robert Kern, Oct 29, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. javahead
    Replies:
    1
    Views:
    1,106
    Erik Max Francis
    Oct 8, 2003
  2. jeffself
    Replies:
    2
    Views:
    4,944
    jeffself
    Jun 27, 2007
  3. Replies:
    1
    Views:
    954
    Robert Kern
    Jul 1, 2008
  4. Replies:
    0
    Views:
    508
  5. wadi wadi
    Replies:
    8
    Views:
    6,625
    wadi wadi
    Oct 30, 2009
Loading...

Share This Page