registerguard / django_odbc

A test of connecting to a DTI Intersystems Caché database using the egenix.com mxODBC Django Database Engine - Django ODBC Adapter.
2 stars 0 forks source link

Add try catch exception for 'inconsistent stream state' error on cache_builder #5

Open jheasly opened 8 years ago

jheasly commented 8 years ago

Occasionally getting this error when cache_builder script runs:

2015-10-30 03:06:03,869: turin.management.commands.cache_builder - DEBUG - 28 stories in SubCategory Elections, Id: 19528764
Traceback (most recent call last):
  File "/Users/jheasly/Development/django_odbc/django_odbc/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/Users/jheasly/Development/django_odbc/django_odbc/turin/management/commands/cache_builder.py", line 56, in handle
    requests.get('http://registerguard.com/rg/news/categories/?subcats=%s' % result[1])
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/requests/api.py", line 69, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/requests/sessions.py", line 605, in send
    r.content
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/requests/models.py", line 750, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "/Users/jheasly/.virtualenvs/django_odbc/lib/python2.7/site-packages/requests/models.py", line 678, in generate
    raise ContentDecodingError(e)
requests.exceptions.ContentDecodingError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -2 while decompressing: inconsistent stream state',))
jheasly commented 8 years ago

Seems to happen every other run: