get_movie broken

108 views
Skip to first unread message

Zsolt Ero

unread,
May 13, 2013, 8:52:06 PM5/13/13
to imdbpy...@googlegroups.com
Hi, I am recently having trouble with imdbpy.

I'm trying to use the code which was working some time ago, but this is what I receive now:

2013-05-14 01:44:52,247 CRITICAL [imdbpy] C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\_exceptions.py:35: IMDbDataAccessError exception raised; args: ({'exception type': 'IOError', 'url': 'http://akas.imdb.com/title/tt0466574/plotsummary', 'errcode': None, 'proxy': '', 'original exception': timeout('timed out',), 'errmsg': 'None'},); kwds: {}
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 206, in retrieve_unicode
    content = uopener.read(**kwds)
  File "C:\Python27\lib\socket.py", line 351, in read
    data = self._sock.recv(rbufsize)
timeout: timed out
2013-05-14 01:44:52,250 CRITICAL [imdbpy] C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\__init__.py:777: caught an exception retrieving or parsing "plot" info set for mopID "0466574" (accessSystem: http)
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\__init__.py", line 772, in update
    ret = method(mopID)
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 514, in get_movie_plot
    cont = self._retrieve(self.urls['movie_main'] % movieID + 'plotsummary')
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 453, in _retrieve
    ret = self.urlOpener.retrieve_unicode(url, size=size)
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 236, in retrieve_unicode
    'original exception': e})
IMDbDataAccessError: {'exception type': 'IOError', 'url': 'http://akas.imdb.com/title/tt0466574/plotsummary', 'errcode': None, 'proxy': '', 'original exception': timeout('timed out',), 'errmsg': 'None'}

or

 2013-05-14 01:45:25,552 CRITICAL [imdbpy] C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\_exceptions.py:35: IMDbDataAccessError exception raised; args: ({'exception type': 'IOError', 'url': 'http://akas.imdb.com/title/tt0972782/combined', 'errcode': None, 'proxy': '', 'original exception': timeout('timed out',), 'errmsg': 'None'},); kwds: {}
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 206, in retrieve_unicode
    content = uopener.read(**kwds)
  File "C:\Python27\lib\socket.py", line 351, in read
    data = self._sock.recv(rbufsize)
timeout: timed out
2013-05-14 01:45:25,553 CRITICAL [imdbpy] C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\__init__.py:777: caught an exception retrieving or parsing "main" info set for mopID "0972782" (accessSystem: http)
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\__init__.py", line 772, in update
    ret = method(mopID)
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 506, in get_movie_main
    cont = self._retrieve(self.urls['movie_main'] % movieID + 'combined')
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 453, in _retrieve
    ret = self.urlOpener.retrieve_unicode(url, size=size)
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\parser\http\__init__.py", line 236, in retrieve_unicode
    'original exception': e})
IMDbDataAccessError: {'exception type': 'IOError', 'url': 'http://akas.imdb.com/title/tt0972782/combined', 'errcode': None, 'proxy': '', 'original exception': timeout('timed out',), 'errmsg': 'None'}
Traceback (most recent call last):
  File "E:\dev\python\imdbcreate\test.py", line 13, in <module>
    print str(counter) + ': ' + movie['country'][0] + " - " + movie['director'][0]['name'] + ' (' + str(movie['year']) + ')      ' + movie['title']
  File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\imdbpy-5.0dev_20130514-py2.7.egg\imdb\utils.py", line 1464, in __getitem__
    rawData = self.data[key]
KeyError: 'countries'


My code is extremely extremely,simple, here is the basic part:

import imdb

im = imdb.IMDb()


title = 'down by law'


results = im.search_movie( title )

counter = 0


for res in results:

counter += 1

id = res.getID()

movie = im.get_movie(id)

print str(counter) + ': ' + movie['country'][0] + " - " + movie['director'][0]['name'] + ' (' + str(movie['year']) + ') ' + movie['title']


Can you tell me what is happening and how can I fix it? I'm on the mercurial tip.


Zsolt




 

Davide Alberani

unread,
May 16, 2013, 2:56:55 AM5/16/13
to imdbpy...@googlegroups.com
On Tue, May 14, 2013 at 2:52 AM, Zsolt Ero <zsol...@gmail.com> wrote:
>
> Hi, I am recently having trouble with imdbpy.

We have a lot of bugs, right now; as usual any help is welcome.

However, in your specific case, it seems to be a network problem.
Are you sure it's not your connection?

The get_movie example script works for me; can you provide the
command you've run?
I've tried:
get_movie.py 0133093


--
Davide Alberani <davide....@gmail.com> [PGP KeyID: 0x465BFD47]
http://www.mimante.net/

Zsolt Ero

unread,
May 16, 2013, 9:52:41 AM5/16/13
to imdbpy...@googlegroups.com
Hi Davide,

It seems that it depends on the specific movie. Maybe this movie has a large list of characters or something. Even for this one, eventually I was able to get the data, after trying 5x times. So it somehow depends on the size of the movie as well as the load of the network.

Actually, I tried it now and it gets it 100%. So it really is depending on the network! My network gets slow at peak hours, but it shouldn't be a reason not to download a few bytes.

Is there any way to set the timeout of the sockets manually? I think a loong timeout might solve it, something like 120 sec or similar.

Regards,
Zsolt





--
You received this message because you are subscribed to a topic in the Google Groups "imdbpy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/imdbpy-users/eZN7jqan85o/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to imdbpy-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Davide Alberani

unread,
May 18, 2013, 7:46:36 AM5/18/13
to imdbpy...@googlegroups.com, Zsolt Ero
On Thu, May 16, 2013 at 3:52 PM, Zsolt Ero <zsol...@gmail.com> wrote:
>
> Is there any way to set the timeout of the sockets manually? I think a loong
> timeout might solve it, something like 120 sec or similar.

Sure, the IMDbHTTPAccessSystem takes the 'timeout' parameter, set to
30 by default.

So, when you initialize your IMDb() instance, you can just use it:
import imdb
ia = imdb.IMDb('http', timeout=120)


HTH

Zsolt Ero

unread,
May 18, 2013, 10:44:55 AM5/18/13
to Davide Alberani, imdbpy...@googlegroups.com
At thanks, I didn't know about it! I'll see how it goes with this settings!

Zsolt
Reply all
Reply to author
Forward
0 new messages