Comments (10)
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
from django-json-field.
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.
from django-json-field.
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!)
from django-json-field.
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.
from django-json-field.
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!
from django-json-field.
Can you try running import dateutil
? I assumed it was included in all Python distributions but perhaps that is not the case.
from django-json-field.
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
:(
from django-json-field.
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.
from django-json-field.
Thank you so much, Derek!
from django-json-field.
No problem! Also, I just updated the code to remove the unintended dependency on simplejson
so you should be alright now in either case.
from django-json-field.
Related Issues (20)
- Simple use of the formfield throws a KeyError
- TypeError: db_type() got multiple values for keyword argument 'connection' HOT 3
- Decimal rounding HOT 2
- Decoding/encoding time/date/datetime should be optional, if not disabled by default. HOT 1
- JSONFormField should absolutely not be eval-ing user-supplied content. HOT 1
- Can't install from empty virtualenv HOT 1
- Incompatible with Django 1.5 due to change from simplejson to json HOT 5
- `JSONFormField.clean` should return a python object and not it's string representation. HOT 4
- test_decimal fails on django1.5 HOT 2
- Doesn't support Django 1.3 HOT 2
- A nicer error message could be displayed in the case of a wrong value in the admin. HOT 1
- go to build-in Python json instead of simplejson HOT 3
- Why decimal? HOT 6
- Wrong default value for South migration HOT 2
- TypeError: 'NoneType' object is not iterable - for string that begins with date, but not represent date HOT 4
- Django 1.7 compatibility HOT 8
- Django 1.9 compatibility HOT 1
- Json field validation?
- field default set to 'null' is breaking support form modelform's initial data
- installation in django
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-json-field.