scholarly: AttributeError: 'NoneType' object has no attribute 'text'
Python 3.7.3 (default, Mar 26 2019, 21:43:19)
[GCC 8.2.1 20181127] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scholarly
>>> print(next(scholarly.search_author('Steven A. Cholewiak')))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/scholarly/scholarly.py", line 110, in _search_citation_soup
yield Author(row)
File "/usr/lib/python3.7/site-packages/scholarly/scholarly.py", line 226, in __init__
self.name = __data.find('h3', class_='gsc_oai_name').text
AttributeError: 'NoneType' object has no attribute 'text'
OS: Manjaro Linux x86_64
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 20
Commits related to this issue
- Update scholarly.py Based on a comment in Issue #37 perhaps this will fix the bug — committed to hack-r/scholarly by hack-r 5 years ago
Line 226 original: self.name = _data.find(‘h3’, class=‘gsc_oai_name’).tex modification: self.name = _data.find(‘h3’, class=‘gs_ai_name’).text
please update!
For precisely these situations in the pull request I created last week, the class name is extracted dynamically, instead of being hard coded. If Google changes the class name again, Scholarly should continue working fine. #40
@hack-r I made that mistake too, it’s
gs_ai_name
, notgsc_ai_name
Should be easily resolved by renaming
gsc_oai_name
togs_ai_name
.There are five instances that need to be updated: replaces all instances of “gsc_oai” with “gs_ai”.