From 8a90bf5e3fbf19b122889986f03b2a8e5e2b552f Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 14 Oct 2019 19:59:58 +0100 Subject: [PATCH] bug fix --- depicts/wikibase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/depicts/wikibase.py b/depicts/wikibase.py index cd29195..28389e5 100644 --- a/depicts/wikibase.py +++ b/depicts/wikibase.py @@ -1,6 +1,8 @@ def first_datavalue(entity, pid): if pid in entity['claims']: - return entity['claims'][pid][0]['mainsnak']['datavalue']['value'] + mainsnak = entity['claims'][pid][0]['mainsnak'] + if 'datavalue' in mainsnak: + return mainsnak['datavalue']['value'] def get_entity_label(entity): if 'en' in entity['labels']: