md5 strange error

Discussion in 'Python' started by catalinfest@gmail.com, Oct 21, 2009.

  1. Guest

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


    Regards !
     
    , Oct 21, 2009
    #1
    1. Advertising

  2. Super Zyper Guest

    On 21 oct, 10:11, "" <>
    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 "<stdin>", 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.
     
    Super Zyper, Oct 21, 2009
    #2
    1. Advertising

  3. On Wed, Oct 21, 2009 at 1:41 PM,
    <> 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 "<stdin>", 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
     
    Kushal Kumaran, Oct 21, 2009
    #3
  4. Tim Golden Guest

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


    pass is a keyword, as in:

    def f ():
    pass

    TJG
     
    Tim Golden, Oct 21, 2009
    #4
  5. On Wed, 21 Oct 2009 01:11:29 -0700, 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 "<stdin>", 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 "<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.


    --
    Steven
     
    Steven D'Aprano, Oct 22, 2009
    #5
  6. Guest

    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 ?
     
    , Dec 14, 2009
    #6
  7. On Mon, Dec 14, 2009 at 09:33,
    <> 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)
     
    Rami Chowdhury, Dec 14, 2009
    #7
  8. Mel Guest

    Rami Chowdhury wrote:
    > On Mon, Dec 14, 2009 at 09:33,
    > <> 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.
     
    Mel, Dec 14, 2009
    #8
    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. Replies:
    9
    Views:
    17,202
    John Salerno
    May 8, 2006
  2. John Pye

    error with "import md5"

    John Pye, Jan 8, 2007, in forum: Python
    Replies:
    0
    Views:
    317
    John Pye
    Jan 8, 2007
  3. mike
    Replies:
    15
    Views:
    3,560
  4. Peter Woodsky

    create a md5 / md5 passwd with a salt

    Peter Woodsky, Nov 20, 2008, in forum: Ruby
    Replies:
    6
    Views:
    240
    Brian Candler
    Nov 21, 2008
  5. Ibad Kureshi U0850037

    Re: ERROR:root:code for hash md5 was not found

    Ibad Kureshi U0850037, Feb 3, 2013, in forum: Python
    Replies:
    0
    Views:
    229
    Ibad Kureshi U0850037
    Feb 3, 2013
Loading...

Share This Page