Skip to content

TypeError: 'NoneType' object is not iterable - for string that begins with date, but not represent date #33

caxap opened this Issue Jan 28, 2014 · 4 comments

3 participants

caxap commented Jan 28, 2014

Steps to reproduce

>>> import json_field, dateutil
>>> json_field.__version__
>>> dateutil.__version__
>>> from json_field.fields import JSONDecoder
>>> from django.utils import simplejson as json
>>> json_payload = '{"title": "2014-01-27 | Title with date"}'
>>> json.loads(json_payload)  # default decoder - OK
{u'title': u'2014-01-27 | Title with date'}
>>> json.loads(json_payload, cls=JSONDecoder)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/", line 351, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/Users/caxap/Work/pd/api/venv/lib/python2.7/site-packages/json_field/", line 76, in decode
    obj[key] = self.decode(value, recurse=True)
  File "/Users/caxap/Work/pd/api/venv/lib/python2.7/site-packages/json_field/", line 85, in decode
    return date_parser.parse(obj).date()
  File "/Users/caxap/Work/pd/api/venv/lib/python2.7/site-packages/dateutil/", line 748, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/Users/caxap/Work/pd/api/venv/lib/python2.7/site-packages/dateutil/", line 310, in parse
    res, skipped_tokens = self._parse(timestr, **kwargs)
TypeError: 'NoneType' object is not iterable

Addressed in version 0.5.7.


Could you, please, also update pypi package? - no version 0.5.7 available.


Looks like the version was registered but the distribution wasn't available for whatever reason. Should be fixed now.


Derek, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.