md5 strange error

C

catalinfest

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. File "<stdin>", line 1
pass = md5.new()
^
SyntaxError: invalid syntax
Regards !
 
S

Super Zyper

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
  File "<stdin>", line 1
    pass = md5.new()
         ^
SyntaxError: invalid syntax

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.
 
K

Kushal Kumaran

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. File "<stdin>", line 1
   pass = md5.new()
        ^
SyntaxError: invalid syntax

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

Tim Golden

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.File "<stdin>", line 1
pass = md5.new()
^
SyntaxError: invalid syntax

pass is a keyword, as in:

def f ():
pass

TJG
 
S

Steven D'Aprano

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.File "<stdin>", line 1
pass = md5.new()
^
SyntaxError: invalid syntax



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().

File "<stdin>", 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.
 
C

catalinfest

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.__main__:1: DeprecationWarning: the md5 module is deprecated; use
hashlib instead
Why ?
 
R

Rami Chowdhury

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.__main__:1: DeprecationWarning: the md5 module is deprecated; use
hashlib instead
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).
 
M

Mel

Rami said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top