ckan / ckanext-datastorer

Get files from ckan into the webstore.
21 stars 18 forks source link

CaseInsensitiveDict is not JSON serializable #51

Closed seanh closed 11 years ago

seanh commented 11 years ago

I've uploaded this CSV file to a CKAN resource, them I'm running the datastore_update command, and getting:

Traceback (most recent call last):
  File "/home/seanh/Projects/ckan/ckanext-datastorer/ckanext/datastorer/commands.py", line 262, in push_to_datastore
    check_modified=check_hash)
  File "/home/seanh/Projects/ckan/ckanext-datastorer/ckanext/datastorer/fetch_resource.py", line 85, in download
    headers = json.loads(link_checker(link_context, link_data))
  File "/home/seanh/Projects/ckan/ckanext-datastorer/ckanext/datastorer/fetch_resource.py", line 298, in link_checker
    return json.dumps(headers)
  File "/usr/lib/python2.7/json/__init__.py", line 243, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: CaseInsensitiveDict({'content-length': '32244', 'accept-ranges': 'bytes', 'server': 'PasteWSGIServer/0.5 Python/2.7.4', 'last-modified': 'Wed, 18 Sep 2013 09:33:02 GMT', 'content-range': 'bytes 0-32243/32244', 'etag': '"1379496782.47-32244"', 'date': 'Wed, 18 Sep 2013 14:02:34 GMT', 'content-type': 'text/csv'}) is not JSON serializable
[{'resource': u'4f43c6ee-6178-45e3-a144-aa56c336de18', 'success': False, 'error': 'Could not download resource'}, {'resource': u'6a79106f-7f07-40ee-9d3f-fa243a931785', 'success': False, 'error': 'Could not download resource'}]
seanh commented 11 years ago

This was caused by me having the wrong version of requests installed, closing