process_date fails if date is not formatted as YYYY-MM-DD #17

Closed
pnordhus opened this Issue Jul 2, 2012 · 2 comments

Projects

None yet

2 participants

@pnordhus

The day of birth is not necessarily formatted as "YYYY-MM-DD". http://www.themoviedb.org/person/10295, for instance, contains only the year which causes process_date() to fail.

Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tmdb3
>>> tmdb3.set_key('7243d57358963cb7388deb6d1b0f50f5')
>>> person = tmdb3.Person(10295)
>>> print person.name
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tmdb3/util.py", line 143, in __get__
    self.poller.__get__(inst, owner)()
  File "tmdb3/util.py", line 77, in __call__
    self.apply(req.readJSON())
  File "tmdb3/util.py", line 86, in apply
    setattr(self.inst, v, data[k])
  File "tmdb3/util.py", line 148, in __set__
    value = self.handler(value)
  File "tmdb3/util.py", line 163, in <lambda>
    self.handler = lambda x: handler(x)
  File "tmdb3/tmdb_api.py", line 67, in process_date
    return datetime.date(*[int(x) for x in datestr.split('-')])
TypeError: Required argument 'month' (pos 2) not found
>>>
@wagnerrp wagnerrp was assigned Jul 2, 2012
@wagnerrp
Owner

I'll add some code that will make this ignore the problem and allow access to the rest of the data, however upstream decision from Travis Bell is that this is an example of bad data. Proper solution is to correct the data on TMDb itself.

http://help.themoviedb.org/discussions/problems/646-date-format

@wagnerrp
Owner

fc8e6d1 turns these errors into warnings, and allows the rest of the query to be processed and return data to the user.

@wagnerrp wagnerrp closed this Jul 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment