I tried this code:
import hashlib encrypted = hashlib.sha1(string) encrypted = encrypted.digest() But I got an error that says "No Module Named hashlib". What is wrong, and how do I fix it?
I tried this code:
import hashlib encrypted = hashlib.sha1(string) encrypted = encrypted.digest() But I got an error that says "No Module Named hashlib". What is wrong, and how do I fix it?
You've probably got a python version < 2.5. Use the sha module instead.
Here's the differences:
>>> import sha >>> s = sha.new() >>> s.update('hello') >>> s.digest() '\xaa\xf4\xc6\x1d\xdc\xc5\xe8\xa2\xda\xbe\xde\x0f;H,\xd9\xae\xa9CM' vs
>>> import hashlib >>> hashlib.sha1('hello').digest() '\xaa\xf4\xc6\x1d\xdc\xc5\xe8\xa2\xda\xbe\xde\x0f;H,\xd9\xae\xa9CM' The easiest way to find such errors related to the modules no found is to verify their path. I am completely able to run the python facebook ads api code through console but when I try this code through c# i got several path related errors.
Just below given statement before the import statements to give the path of "hashlib.py file".
import sys
It has resolved my problem.