Unable to import JSONDecodeError

I am trying to make the following call:

from simplejson import JSONDecodeError

But I get this error:

from simplejson import JSONDecodeError
ImportError: cannot import name JSONDecodeError

The following information may help:

  • This code works fine in ubuntu, but I get this error on mac .

  • I had several versions of python and I just uninstalled python 2.6 (since I am using python 2.7 )

  • and used easy_install_27to install this particular library.

+9
source share
3 answers

You already have an answer on how to get a JSONDecodeError, but I believe that the right advice should be that you should not try to import it.

, JSONDecodeError simplejson, , Python . json . : fooobar.com/questions/20062/...

: json ValueError JSONDecodeError, JSONDecodeError ( simplejson) ValueError. simplejson ValueError, json simplejson !

+14

:

$ python
Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from simplejson import JSONDecodeError
>>> 

, python, ​​ simplejson? sys.path , . import simplejson? , , (import simplejson; print simplejson.__file__). , , , JSONDecodeError.

0

Update your installation:

$ pip install -U simplejson
$ python
>>> from simplejson import JSONDecodeError
0
source

All Articles