scholarly
scholarly copied to clipboard
StopIteration on search query with DOI (was working a month ago)
Describe the bug
I get a StopIteration
error immediately after calling next
on a search query which contains a DOI. The same code has been working for many months, but stopped working suddenly. It appears that scholarly fails to find (or parse?) the document. The DOI used seems negligible (I have tried several others and all yield the same behavior).
To Reproduce
from scholarly import scholarly, ProxyGenerator
search_query = scholarly.search_pubs('10.1007/978-3-031-09037-0_20')
pub = next(search_query)
print(pub['num_citations'])
Expected behavior
The code should run through without errors being raised (and a 0
should be printed).
Desktop (please complete the following information):
- python version: 3.7.13
- OS: Ubuntu 20.04.6
- Version: 1.7.11
Do you plan on contributing? Your response below will clarify whether the maintainers can expect you to fix the bug you reported.
- [ ] Yes, I will create a Pull Request with the bugfix.
Additional context I have tried this with scholarly 1.7.9 and 1.7.11, installed via pip.
Probably the same as #508 . Google Scholar have a new class in the UI for when there is a single result. I posted a simple patch while waiting for better fix.
The workaround mentioned in #508 indeed works.