Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import name json_util #17

Open
cmoulliard opened this issue Aug 31, 2012 · 5 comments
Open

cannot import name json_util #17

cmoulliard opened this issue Aug 31, 2012 · 5 comments

Comments

@cmoulliard
Copy link

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 , line 9
Python Executable: /usr/bin/python
Python Version: 2.7.1
Python Path:
['/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

@rmachado
Copy link

rmachado commented Sep 6, 2012

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

@cmoulliard
Copy link
Author

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//issues/17#issuecomment-8339866.

Charles Moulliard
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Twitter : @cmoulliard
Blog : http://cmoulliard.blogspot.com

@larroy
Copy link

larroy commented Sep 23, 2012

I have fixed this on my fork.

@Trigu
Copy link

Trigu commented Oct 23, 2012

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']

@ruli
Copy link

ruli commented Nov 27, 2012

@Trigu try from bson import json_util for line 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants