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

None type in retrieving Wikidata #3

Open
roopavsm opened this issue Feb 1, 2022 · 0 comments
Open

None type in retrieving Wikidata #3

roopavsm opened this issue Feb 1, 2022 · 0 comments

Comments

@roopavsm
Copy link
Collaborator

roopavsm commented Feb 1, 2022

from py4ami.wikimedia import WikidataLookup
wikidata_lookup = WikidataLookup()
file1 = open('extracted_phrases.txt', 'r')
Lines = file1.readlines()
for line in Lines:
print(line)
if line.starts_with("-"):
continue
qitem0, desc, wikidata_hits = wikidata_lookup.lookup_wikidata(line)
print("HITS", wikidata_hits)
print("End of the program")

Produces the error:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "", line 7, in
File "C:\Users\Roopa\PycharmProjects\vsmr2\venv\lib\site-packages\py4ami\wikimedia.py", line 69, in lookup_wikidata
self.wikidata_dict = self.create_dict_for_all_possible_wd_matches(ul)
File "C:\Users\Roopa\PycharmProjects\vsmr2\venv\lib\site-packages\py4ami\wikimedia.py", line 102, in create_dict_for_all_possible_wd_matches
self.add_subdict_title_desc_statements(li, qitem, result_heading_a, wikidata_dict)
File "C:\Users\Roopa\PycharmProjects\vsmr2\venv\lib\site-packages\py4ami\wikimedia.py", line 110, in add_subdict_title_desc_statements
sub_dict[DESC] = li.find("./div[@Class='" + SEARCH_RESULT + "']/span").text
AttributeError: 'NoneType' object has no attribute 'text'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant