Python 3.1 simplejson install

D

dirknbr

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
 
P

Peter Otten

dirknbr said:
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
 
C

Chris Rebert

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
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top