Re: md5 strange error

2009-12-14 Thread Mel
Rami Chowdhury wrote:
> On Mon, Dec 14, 2009 at 09:33, catalinf...@gmail.com
>  wrote:
>> now i have Fedora 12
>> Now when i try to use md5 , python say :
>> python
>> Python 2.6.2 (r262:71600, Aug 21 2009, 12:22:21)
>> [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
> import md5
>> __main__:1: DeprecationWarning: the md5 module is deprecated; use
>> hashlib instead
> import md5

>> Why ?

> As the message says: the md5 module is deprecated, and you should use
> the hashlib module instead. I believe md5 is deprecated from Python
> 2.6 onwards, which may be why you have not seen this message before
> (Fedora 12 is the first Fedora to ship with Python 2.6).

When this gets in the way (package builds, etc.,) you can get rid of it by 
invoking Python with a command line argument:

python -Wignore::DeprecationWarning


Mel.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-12-14 Thread Rami Chowdhury
On Mon, Dec 14, 2009 at 09:33, catalinf...@gmail.com
 wrote:
> now i have Fedora 12
> Now when i try to use md5 , python say :
>  python
> Python 2.6.2 (r262:71600, Aug 21 2009, 12:22:21)
> [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 import md5
> __main__:1: DeprecationWarning: the md5 module is deprecated; use
> hashlib instead
 import md5

>
> Why ?

As the message says: the md5 module is deprecated, and you should use
the hashlib module instead. I believe md5 is deprecated from Python
2.6 onwards, which may be why you have not seen this message before
(Fedora 12 is the first Fedora to ship with Python 2.6).


Rami Chowdhury
"Never assume malice when stupidity will suffice." -- Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-12-14 Thread catalinf...@gmail.com
now i have Fedora 12
Now when i try to use md5 , python say :
 python
Python 2.6.2 (r262:71600, Aug 21 2009, 12:22:21)
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import md5
__main__:1: DeprecationWarning: the md5 module is deprecated; use
hashlib instead
>>> import md5
>>>

Why ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-10-21 Thread Steven D'Aprano
On Wed, 21 Oct 2009 01:11:29 -0700, catalinf...@gmail.com wrote:

> I have this error , what happen ?
> 
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917
> (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or
> "license" for more information.
 import md5
 pass = md5.new()
>   File "", line 1
> pass = md5.new()
>  ^
> SyntaxError: invalid syntax
 m = md5.new()
 n = md5.new()



What makes you think it's an error with md5? As you can see, md5 works 
fine. The error message tells you the problem occurs *before* the call to 
md5.new().


>>> pass = 45
  File "", line 1
pass = 45
 ^
SyntaxError: invalid syntax


As others have told you, it's a problem with pass, which is a statement 
and reserved word.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-10-21 Thread Rhodri James
On Wed, 21 Oct 2009 23:28:24 +0100, Stephen Fairchild  
 wrote:



Tim Golden wrote:


catalinf...@gmail.com wrote:

I have this error , what happen ?

Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import md5
pass = md5.new()

  File "", line 1
pass = md5.new()
 ^
SyntaxError: invalid syntax


pass is a keyword, as in:

def f ():
  pass



Correct form when you want to use a keyword for a variable is to precede  
it

with and underscore.

_pass = md5.new()


Other way round; you put the underscore at the end according to PEP-8
(http://www.python.org/dev/peps/pep-0008/)

pass_ = md5.new()

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-10-21 Thread Stephen Fairchild
Tim Golden wrote:

> catalinf...@gmail.com wrote:
>> I have this error , what happen ?
>> 
>> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
>> [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
> import md5
> pass = md5.new()
>>   File "", line 1
>> pass = md5.new()
>>  ^
>> SyntaxError: invalid syntax
> 
> pass is a keyword, as in:
> 
> def f ():
>   pass
> 

Correct form when you want to use a keyword for a variable is to precede it
with and underscore.

_pass = md5.new() 

-- 
Stephen Fairchild
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-10-21 Thread Kushal Kumaran
On Wed, Oct 21, 2009 at 1:41 PM, catalinf...@gmail.com
 wrote:
> I have this error , what happen ?
>
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 import md5
 pass = md5.new()
>  File "", line 1
>    pass = md5.new()
>         ^
> SyntaxError: invalid syntax
 m = md5.new()
 n = md5.new()
>

pass is a python keyword.  You'll need a different name for the variable.

-- 
regards,
kushal
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-10-21 Thread Tim Golden

catalinf...@gmail.com wrote:

I have this error , what happen ?

Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import md5
pass = md5.new()

  File "", line 1
pass = md5.new()
 ^
SyntaxError: invalid syntax


pass is a keyword, as in:

def f ():
 pass

TJG
--
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-10-21 Thread Xavier Ho
On Wed, Oct 21, 2009 at 6:11 PM, catalinf...@gmail.com <
catalinf...@gmail.com> wrote:

> >>> pass = md5.new()
>  File "", line 1
>pass = md5.new()
> ^
> SyntaxError: invalid syntax
>

pass is a keyword in Python, you can't use it as an identifier.

Try password instead.

Cheers,
Xav
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: md5 strange error

2009-10-21 Thread Super Zyper
On 21 oct, 10:11, "catalinf...@gmail.com" 
wrote:
> I have this error , what happen ?
>
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import md5
> >>> pass = md5.new()
>
>   File "", line 1
>     pass = md5.new()
>          ^
> SyntaxError: invalid syntax
>
> >>> m = md5.new()
> >>> n = md5.new()
>
> Regards !

"pass" is a Python reserved keyword so you can't use it as a
variable !

This keywork can be used to conserve python indentation but you have
nothing especially to do.
-- 
http://mail.python.org/mailman/listinfo/python-list