Closed GuysBarash closed 4 years ago
Were you able to figure anything out? I am having the same issue, and I'm lost when trying to debug it.
Maybe @dahlia can give us some insight. However, it seems like he hasn't touched the code for about 5 months.
In the case of Q1893392
, the problem is that the exact date of birth is not given, only the year. Python doesn't have a native data type for years, so the conversion from Wikidata's format isn't implemented.
You can fix this either by finding a more accurate source and updating the Wikidata entry (I've done that a few times) or, if that's not an option, treat it the same as missing data.
Alternatively, you could submit a PR to this repo that supports data and time values with different precision from the native Python types. Personally, I've chosen option 2.
Maybe @dahlia can give us some insight. However, it seems like he hasn't touched the code for about 5 months.
Indeed, recently I haven't managed to look into the project. However, if someone sends a patch to fix this I am going to review it as soon as possible.
In the case of
Q1893392
, the problem is that the exact date of birth is not given, only the year. Python doesn't have a native data type for years, so the conversion from Wikidata's format isn't implemented.
Year numbers could be represented as a simple int
.
When i run:
The error is: Traceback (most recent call last): File "C:\Python37\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 7, in
birthdate = entity[p].label
File "C:\Python37\lib\site-packages\wikidata\entity.py", line 160, in getitem
result = self.getlist(key)
File "C:\Python37\lib\site-packages\wikidata\entity.py", line 191, in getlist
for snak in (claim['mainsnak'] for claim in claims)]
File "C:\Python37\lib\site-packages\wikidata\entity.py", line 191, in
for snak in (claim['mainsnak'] for claim in claims)]
File "C:\Python37\lib\site-packages\wikidata\client.py", line 178, in decode_datavalue
return decode(self, datatype, datavalue)
File "C:\Python37\lib\site-packages\wikidata\datavalue.py", line 127, in call
return method(client, datavalue)
File "C:\Python37\lib\site-packages\wikidata\datavalue.py", line 210, in time
datavalue
wikidata.datavalue.DatavalueError: 9: time precision other than 11 or 14 is unsupported: {'type': 'time', 'value': {'time': '+1905-01-01T00:00:00Z', 'timezone': 0, 'before': 0, 'after': 0, 'precision': 9, 'calendarmodel': 'http://www.wikidata.org/entity/Q1985727'}}