-
Notifications
You must be signed in to change notification settings - Fork 30
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
UnboundLocalError in request_class.py #123
Comments
Thank you for the report @vgreg Can you please share a reproducible example that caused this error? Seems like the |
I am still looking for an example that will consistently reproduce the error. I was retrieving all articles for a set of about 150 journals and had the error occur for two journals, but I have been to re-run the request for both with no issue the second time. Here is a simplified version of a request that failed once but has been working every other time: from habanero import Crossref
cr = Crossref()
query = {"issn": "0028-3932"}
responses = cr.works(
filter=query, cursor="*", cursor_max=12000
)
|
Thanks - I'll see if I can get that to fail |
This may be difficult to track down - the facat that it doesn't happen consistently suggests it's an intermittent problem with the Crossref API |
I was able to reproduce a similar error and see what gets printed on line 163. Here is the exception:
It seems that However, the code continues to line 164 with |
Okay, thanks for this. I'll try to get to this soon |
Having the same issue...
Let me know if I can help with debugging (but the run continues despite the error...) |
thanks for your report @sdspieg ! Sorry about the issue. I started working on this, but I just haven't had time to finish it off. I'll let you know if I could use any help. |
@vgreg @sdspieg Can both of you reinstall from Github and try again? |
closing for now, if it pops up again ping here |
Python 3.11
Habanero 1.2.3
I'm getting the following error on line 164 of
request_class.py
:UnboundLocalError: cannot access local variable 'r' where it is not associated with a value
.It seem that you can reach that line (
check_json(r)
) withr
undefined ifrequests.get()
raises aRequestException
before returning. Because the exception is caught and printed, the code continues withr
still undefined.habanero/habanero/request_class.py
Lines 143 to 165 in 5228483
The text was updated successfully, but these errors were encountered: