Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

pnordhus opened this issue Jul 2, 2012 · 2 comments
Assignees

Comments

@pnordhus
Copy link

pnordhus commented Jul 2, 2012

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
>>>
@ghost ghost assigned wagnerrp Jul 2, 2012
@wagnerrp
Copy link
Owner

wagnerrp commented Jul 2, 2012

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
Copy link
Owner

wagnerrp commented Jul 2, 2012

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 as completed Jul 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants