Git Product home page Git Product logo

Comments (10)

derek-schaefer avatar derek-schaefer commented on June 28, 2024 1

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.

derek-schaefer avatar derek-schaefer commented on June 28, 2024

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.

EugeneDae avatar EugeneDae commented on June 28, 2024

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.

derek-schaefer avatar derek-schaefer commented on June 28, 2024

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.

EugeneDae avatar EugeneDae commented on June 28, 2024

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.

derek-schaefer avatar derek-schaefer commented on June 28, 2024

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.

EugeneDae avatar EugeneDae commented on June 28, 2024

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.

derek-schaefer avatar derek-schaefer commented on June 28, 2024

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.

EugeneDae avatar EugeneDae commented on June 28, 2024

Thank you so much, Derek!

from django-json-field.

derek-schaefer avatar derek-schaefer commented on June 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.