Closed EugeneDae closed 12 years ago
The issue was caused by an internal compatibility issue with gettext()
and South, which I just fixed.
Thanks for the report! Let me know if you are still having issues after updating.
Unfortunately even after updating (I did pip uninstall django-json-field
and then pip install -e git+git://github.com/derek-schaefer/django-json-field.git#egg=json_field
) I still get the same errors.
It doesn't look like the problem is related to south, because I can't even import json_field from Django shell:
(test)Dae-MacPro:test Dae$ python manage.py shell
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from json_field import JSONField
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: cannot import name JSONField
At the same time just import json_field
seem to work (so no "no module named ..." error).
More like I did something wrong... (I'm new to Django, sorry!)
It looks like you did everything correctly and have your virtualenv running, so I'm not sure what the problem might be.
The only thing I can think of is that another import error is happening down the line. Try editing json_field/__init__.py
and removing the try/except
block. Maybe that will provide more information.
Unfortunately the error was the same when I removed the try/except
block from __init__.py
I decided to try a new virtualenv and it's the same. Here's the full log:
Dae-MacPro:~ Dae$ mkvirtualenv jsonfieldtest
New python executable in jsonfieldtest/bin/python
Installing setuptools............done.
Installing pip...............done.
virtualenvwrapper.user_scripts creating /Users/Dae/.virtualenvs/jsonfieldtest/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/Dae/.virtualenvs/jsonfieldtest/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/Dae/.virtualenvs/jsonfieldtest/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/Dae/.virtualenvs/jsonfieldtest/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/Dae/.virtualenvs/jsonfieldtest/bin/get_env_details
(jsonfieldtest)Dae-MacPro:~ Dae$ pip install django
Downloading/unpacking django
Downloading Django-1.4.tar.gz (7.6Mb): 7.6Mb downloaded
Running setup.py egg_info for package django
Installing collected packages: django
Running setup.py install for django
changing mode of build/scripts-2.7/django-admin.py from 644 to 755
changing mode of /Users/Dae/.virtualenvs/jsonfieldtest/bin/django-admin.py to 755
Successfully installed django
Cleaning up...
(jsonfieldtest)Dae-MacPro:~ Dae$ django-admin.py startproject jsonfieldtest
(jsonfieldtest)Dae-MacPro:~ Dae$ cd jsonfieldtest
(jsonfieldtest)Dae-MacPro:jsonfieldtest Dae$ pip install -e git+git://github.com/derek-schaefer/django-json-field.git#egg=json_field
(jsonfieldtest)Dae-MacPro:jsonfieldtest Dae$ python manage.py startapp core
(jsonfieldtest)Dae-MacPro:jsonfieldtest Dae$ mate .
Obtaining json-field from git+git://github.com/derek-schaefer/django-json-field.git#egg=json_field
Cloning git://github.com/derek-schaefer/django-json-field.git to /Users/Dae/.virtualenvs/jsonfieldtest/src/json-field
Running setup.py egg_info for package json-field
Installing collected packages: json-field
Running setup.py develop for json-field
Creating /Users/Dae/.virtualenvs/jsonfieldtest/lib/python2.7/site-packages/django-json-field.egg-link (link to .)
Adding django-json-field 0.2 to easy-install.pth file
Installed /Users/Dae/.virtualenvs/jsonfieldtest/src/json-field
Successfully installed json-field
Cleaning up...
(jsonfieldtest)Dae-MacPro:jsonfieldtest Dae$ python manage.py shell
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from json_field import JSONField
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: cannot import name JSONField
>>> quit()
Thank you!
Can you try running import dateutil
? I assumed it was included in all Python distributions but perhaps that is not the case.
Yes, I believe dateutil
is the problem. It is not installed by default on Mac or Windows systems (and possibly some Linux distributions as well). I'm updating the documentation to reflect this.
Please run pip install python-dateutil
THANK YOU!
pip install python-dateutil
has indeed fixed the problem!
However, I went through south migrations, even did runserver and now stuck at
'module' object has no attribute 'JSONDecodeError'
Django Version: 1.4
Exception Type: AttributeError
Exception Value:
'module' object has no attribute 'JSONDecodeError'
Exception Location: /Users/Dae/.virtualenvs/booker/src/json-field/json_field/fields.py in to_python, line 100
:(
Even though Django includes a basic version of simplejson
it doesn't seem to include the JSONDecodeError
class. Run pip install simplejson
and try again. I'll try to make this more flexible.
Thank you so much, Derek!
No problem! Also, I just updated the code to remove the unintended dependency on simplejson
so you should be alright now in either case.
I haven't managed to install the package.
and when doing south migration:
I tried Django shell
I'm using Django 1.4. I tried installing from repo and pip, no difference.
What might be the problem?
Thanks