1. Davide Alberani
  2. imdbpy
  3. Issues
Issue #43 closed

IMDbDataAccessError: timed out

Thomas Dietrich
created an issue

Hey there,

when using imdbpy, I randomly get the following exception, causing my program to exit. This behavior is new and I'm not sure how to tackle it. Is this something imdbpy can handle or do I have to catch this myself?

Testet with IMDbPY-5.1dev_r0_20150217

2015-02-17 17:39:07,763 CRITICAL [imdbpy] /usr/local/lib/python2.7/dist-packages/IMDbPY-5.1dev_r0_20150217-py2.7-linux-x86_64.egg/imdb/_exceptions.py:35: IMDbDataAccessError exception raised; args: ({'exception type': 'IOError', 'url': 'http://akas.imdb.com/title/tt0443649/combined', 'errcode': 'socket error', 'proxy': '', 'original exception': IOError('socket error', timeout('timed out',)), 'errmsg': 'timed out'},); kwds: {}
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/IMDbPY-5.1dev_r0_20150217-py2.7-linux-x86_64.egg/imdb/parser/http/__init__.py", line 202, in retrieve_unicode
    uopener = self.open(url)
  File "/usr/lib/python2.7/urllib.py", line 208, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.7/urllib.py", line 345, in open_http
    h.endheaders(data)
  File "/usr/lib/python2.7/httplib.py", line 969, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 829, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 791, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 772, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
IOError: [Errno socket error] timed out
2015-02-17 17:39:07,767 CRITICAL [imdbpy] /usr/local/lib/python2.7/dist-packages/IMDbPY-5.1dev_r0_20150217-py2.7-linux-x86_64.egg/imdb/__init__.py:777: caught an exception retrieving or parsing "main" info set for mopID "0443649" (accessSystem: http)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/IMDbPY-5.1dev_r0_20150217-py2.7-linux-x86_64.egg/imdb/__init__.py", line 772, in update
    ret = method(mopID)
  File "/usr/local/lib/python2.7/dist-packages/IMDbPY-5.1dev_r0_20150217-py2.7-linux-x86_64.egg/imdb/parser/http/__init__.py", line 506, in get_movie_main
    cont = self._retrieve(self.urls['movie_main'] % movieID + 'combined')
  File "/usr/local/lib/python2.7/dist-packages/IMDbPY-5.1dev_r0_20150217-py2.7-linux-x86_64.egg/imdb/parser/http/__init__.py", line 453, in _retrieve
    ret = self.urlOpener.retrieve_unicode(url, size=size)
  File "/usr/local/lib/python2.7/dist-packages/IMDbPY-5.1dev_r0_20150217-py2.7-linux-x86_64.egg/imdb/parser/http/__init__.py", line 236, in retrieve_unicode
    'original exception': e})
IMDbDataAccessError: {'exception type': 'IOError', 'url': 'http://akas.imdb.com/title/tt0443649/combined', 'errcode': 'socket error', 'proxy': '', 'original exception': IOError('socket error', timeout('timed out',)), 'errmsg': 'timed out'}

Comments (4)

  1. Thomas Dietrich reporter

    my workaround:

        for _ in range(5):
            try:
                movie = ia.get_movie(id)
                break
            except IMDbDataAccessError:
                print "IMDbDataAccessError"
                sleep(5)
        if not ('movie' in locals() or 'movie' in globals()):
            print "SKIP - fix this!"
            return None
    
  2. Log in to comment