On Mon, Sep 21, 2009 at 09:55, Nicolas Dumazet nicdumz@gmail.com wrote:
2009/9/21 Milos Rancic millosh@gmail.com:
I've found one more thing...
Inside of query.py there are lines for loading json or simplejson:
try: #For Python 2.6 newer import json except ImportError: import simplejson as json
I am not using 2.6, but 2.5.4, but I have module json.
What module is this? A json module, under 2.5? Where did you get it?
However, there are two json.loads commands:
# This will also work, but all unicode strings will need to be converted from \u notation # decodedObj = eval( jsontext ) if back_response: return res, json.loads( jsontext ) else: return json.loads( jsontext )
... and simplejson has it, but json doesn't. So, I've fixed my pywikipediabot by commenting try-except at the beginning and leaving just "import simplejson as json".
import json is meant for 2.6. In 2.6, json _has_ the loads method: http://docs.python.org/library/json.html#json.loads
-- Nicolas Dumazet — NicDumZ
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Here is the info:
millosh@wintermute:~$ dpkg -l | grep json ii python-cjson 1.0.5-1 Very fast JSON encoder/decoder for Python ii python-cjson-dbg 1.0.5-1 Very fast JSON encoder/decoder for Python (debug extension) ii python-json 3.4-4 a JSON (http://json.org) reader and writer in Python ii python-simplejson 2.0.9-1 Simple, fast, extensible JSON encoder/decoder for Python
millosh@wintermute:~$ python Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import json dir(json)
['JsonReader', 'JsonWriter', 'ReadException', 'WriteException', '_StringGenerator', '__builtins__', '__doc__', '__file__', '__name__', 'read', 'string', 'types', 'write']
Debian Unstable is installed on computer.