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
Missing 'title' attribute causes "AttributeError: object has no attribute 'title'" error #71
Comments
Huh! What an odd edge case. Adding the api tag as a reminder to mention this with the arXiv API folks––this field should either be present and empty or the API docs should indicate the field is optional. Thinking about work-arounds.
What seems more sensible as a default?
I lean towards |
Sent a message to the Google Group. It may be safe to assume that any entry without a |
Thanks for the quick message back. Yeah, the longer term solution you mentioned makes sense. I agree with you - None would make more sense and hopefully the regression tests can check to make sure it doesn't introduce faults in other areas (I have not really read the entire code base, just those that was impacting the runs). |
Got confirmation that this is an API bug. I'll write a patch that defaults the title to There's a chance we can't draw that conclusion. If we observe other titles causing this issue––e.g. I'll add an accompanying test case. |
+ Remove .get usage in new unit test + Remove .get reference in error docstrings
Description
Traceback (most recent call last):
File ".\retrieve_arxiv.py", line 21, in
for result in big_slow_client.get(unrestricted_search):
File "E:\Dropbox\Coding\arXiv\arxiv\arxiv.py", line 547, in get
yield Result._from_feed_entry(entry)
File "E:\Dropbox\Coding\arXiv\arxiv\arxiv.py", line 116, in _from_feed_entry
title=re.sub(r'\s+', ' ', entry.title),
File "C:\Users\gerry\Miniconda3\envs\arxiv\lib\site-packages\feedparser\util.py", line 158, in getattr
raise AttributeError("object has no attribute '%s'" % key)
AttributeError: object has no attribute 'title'
Steps to reproduce
from arxiv import arxiv
import csv
search = arxiv.Search(
id_list=['2104.12255v1'],
sort_by = arxiv.SortCriterion.LastUpdatedDate
)
for result in search.get():
print(result.entry_id)
print(list(result.dir()))
print()
Expected behavior
Versions
python
version:Python 3.8
arxiv.py
version:arxiv.py == 1.2.0
Additional context
The text was updated successfully, but these errors were encountered: