new is missing in module hmac SHA-based encryption function in Python
Hailong Wang
hailong.wang at gmail.com
Wed Nov 21 11:40:59 EST 2007
Matt,
Thanks for response, I changed my script to hw_hmac.py, but still does not
work.
Traceback (most recent call last):
File "C:/Python25/hw_script/my_hmac.py", line 1, in <module>
import hmac
File "C:\Python25\hw_script\hmac.py", line 4, in <module>
myhmac = hmac.new("test")
AttributeError: 'module' object has no attribute 'new'
>>>
On Nov 21, 2007 8:35 AM, Matt Nordhoff <mnordhoff at mattnordhoff.com> wrote:
> Hailong Wang wrote:
> > I have small hmac encryption programm by python, but always complain
> > that hmac module does not have attribute new, do I need to install
> > anything additinal in my laptop? I am using python 2.5.1
> >
> > import hmac
> > import md5
> > import sha
> > myhmac = hmac.new("test")
> >
> >
> > Traceback (most recent call last):
> > File "C:\Python25\hw_script\hmac.py", line 1, in <module>
> > import hmac
> > File "C:\Python25\hw_script\hmac.py", line 4, in <module>
> > myhmac = hmac.new("test")
> > AttributeError: 'module' object has no attribute 'new'
>
> Your script is called "hmac.py", so it's importing itself. You need to
> name it something else.
> --
>
--
Best regards,
Harold(Hailong) Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071121/2b66032a/attachment.html>
More information about the Python-list
mailing list