Fang-of-Mongo
Fang-of-Mongo copied to clipboard
cannot import name json_util
Hi,
Even if json-utils is installed (pip install json_utils), I still get this error :
ImportError at /fangofmongo/
cannot import name json_util
Request Method: GET
Request URL: http://localhost:8000/fangofmongo/
Django Version: 1.4.1
Exception Type: ImportError
Exception Value:
cannot import name json_util
Exception Location: /Users/chmoulli/Temp/Fang-of-Mongo/fangofmongo/fom/views.py in
['/Users/chmoulli/Temp/Fang-of-Mongo/fangofmongo',
'/Library/Python/2.7/site-packages/Pygments-1.5-py2.7.egg',
'/Library/Python/2.7/site-packages/nodeenv-0.5.2-py2.7.egg',
'/Library/Python/2.7/site-packages/Markdown-2.1.1-py2.7.egg',
'/Library/Python/2.7/site-packages/elementtree-1.2.7_20070827_preview-py2.7.egg',
'/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
'/Library/Python/2.7/site-packages']
What is the python dependency which is missing ?
Regards,
Charles
Hi,
The module json_util has been deprecated since version 1.9. Use bson.json_util instead. http://api.mongodb.org/python/2.0.1/api/pymongo/json_util.html Replacing the imports should fix it.
Regards
Thx for the info.
On Thu, Sep 6, 2012 at 7:10 PM, Rodrigo Machado [email protected]:
Hi,
The module json_util has been moved from pymongo to bson since version 1.9 http://api.mongodb.org/python/2.0.1/api/pymongo/json_util.html Replacing the imports should fix it.
Regards
— Reply to this email directly or view it on GitHubhttps://github.com/Fiedzia/Fang-of-Mongo/issues/17#issuecomment-8339866.
Charles Moulliard Apache Committer / Sr. Pr. Consultant at FuseSource.com Twitter : @cmoulliard Blog : http://cmoulliard.blogspot.com
I have fixed this on my fork.
Had the same error and i get this one when i change json_util for bson.json_util :
invalid syntax (views.py, line 9)
Request Method: GET Request URL: http://localhost:8000/fangofmongo/ Django Version: 1.4.2 Exception Type: SyntaxError
Exception Value:
invalid syntax (views.py, line 9)
Exception Location: /usr/local/lib/python2.7/dist-packages/django/utils/importlib.py in import_module, line 35
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path:
['/home/serveur/Downloads/mongodbUI/fangofmongo',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7']
@Trigu try from bson import json_util
for line 9