Python 3.1 simplejson install

Discussion in 'Python' started by dirknbr, Jan 29, 2010.

  1. dirknbr

    dirknbr Guest

    I am trying to install simplejson on Python 3.1 on Windows. When I do
    'python setup.py install' I get 'except DisutilsPlatformError, x:
    SyntaxError' with a dash under the comma.

    Any ideas?

    Dirk
    dirknbr, Jan 29, 2010
    #1
    1. Advertising

  2. dirknbr

    Peter Otten Guest

    dirknbr wrote:

    > I am trying to install simplejson on Python 3.1 on Windows. When I do
    > 'python setup.py install' I get 'except DisutilsPlatformError, x:
    > SyntaxError' with a dash under the comma.


    You are trying to install a package written for Python 2.x on 3.x, and some
    of the 2.x Syntax is illegal in Python 3.

    I recommend that you use the json module instead that is already included in
    the 3.1 distribution, see

    http://docs.python.org/3.1/library/json.html

    Peter
    Peter Otten, Jan 29, 2010
    #2
    1. Advertising

  3. dirknbr

    Chris Rebert Guest

    On Fri, Jan 29, 2010 at 6:33 AM, Peter Otten <> wrote:
    > dirknbr wrote:
    >> I am trying to install simplejson on Python 3.1 on Windows. When I do
    >> 'python setup.py install' I get 'except DisutilsPlatformError, x:
    >> SyntaxError' with a dash under the comma.

    >
    > You are trying to install a package written for Python 2.x on 3.x, and some
    > of the 2.x Syntax is illegal in Python 3.


    To be specific (http://www.python.org/dev/peps/pep-3110/):

    "the ambiguous
    except A, B:
    which would mean different things in Python 2.x and 3.x -- leading to
    hard-to-catch bugs -- cannot legally occur in 3.x code."

    The except statement in your error would be properly written in 3.x as:
    except DisutilsPlatformError as x:

    Cheers,
    Chris
    --
    http://blog.rebertia.com
    Chris Rebert, Jan 29, 2010
    #3
    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. Andrey

    simpleJSON pack binary data

    Andrey, Jul 22, 2007, in forum: Python
    Replies:
    1
    Views:
    325
    Marc 'BlackJack' Rintsch
    Jul 22, 2007
  2. Robin Becker

    simplejson setup problem

    Robin Becker, Dec 11, 2007, in forum: Python
    Replies:
    0
    Views:
    308
    Robin Becker
    Dec 11, 2007
  3. Replies:
    11
    Views:
    692
  4. lookon
    Replies:
    2
    Views:
    280
    lookon
    Jul 22, 2008
  5. Arthur Mc Coy

    python simplejson decoding

    Arthur Mc Coy, Mar 2, 2011, in forum: Python
    Replies:
    3
    Views:
    1,676
    Arthur Mc Coy
    Mar 4, 2011
Loading...

Share This Page