pediapress / mwlib

mediawiki parser library
103 stars 35 forks source link

Inconsistent importation of json and simplejson #7

Closed Arfrever closed 12 years ago

Arfrever commented 12 years ago

Some modules firstly try to import simplejson, while others json. This can result in importing both json and simplejson:

$ python2.7
Python 2.7.2+ (2.7:f1ee3bb6ba64+, Jan 29 2012, 20:33:23) 
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import mwlib.siteinfo.fetch_siteinfo
>>> sys.modules["json"]
<module 'json' from '/usr/lib64/python2.7/json/__init__.pyc'>
>>> sys.modules["simplejson"]
<module 'simplejson' from '/usr/lib64/python2.7/site-packages/simplejson/__init__.pyc'>
>>>

I suggest that all modules firstly try to import simplejson before json.

schmir commented 12 years ago

Do you care enough to provide a patch?

Arfrever commented 12 years ago

http://people.apache.org/~Arfrever/mwlib-json.patch