dkoslicki / NCATS

MIT License
2 stars 0 forks source link

Catching NCBI eUtils timeout #111

Closed dkoslicki closed 6 years ago

dkoslicki commented 6 years ago

HTTP timeout in QueryNCBIeUtils.py; URL: https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=%28%22trabecular%20bone%20tissue%22%5BMeSH%20Terms%5D%29%20AND%20%22Pneumonia%2C%20Ventilator-Associated%22%5BMeSH%20Terms%5D&retmode=json&retmax=1000 Traceback (most recent call last): File "Q2Solution.py", line 188, in main() File "Q2Solution.py", line 183, in main res = answerQ2(drug, disease_description) File "Q2Solution.py", line 109, in answerQ2 anat_name_google_distance = Q2Utils.prioritize_on_gd(found_anat_names, disease_description) File "/home/dkoslicki/Dropbox/Repositories/NCATS/code/reasoningtool/Q2Utils.py", line 284, in prioritize_on_gd gd = QueryNCBIeUtils.QueryNCBIeUtils.normalized_google_distance(description, disease_description) File "/home/dkoslicki/Dropbox/Repositories/NCATS/code/reasoningtool/QueryNCBIeUtils.py", line 191, in normalized_google_distance mesh2=mesh2_str)) File "/home/dkoslicki/Dropbox/Repositories/NCATS/code/reasoningtool/QueryNCBIeUtils.py", line 178, in get_pubmed_hits_count status_code = res.status_code AttributeError: 'NoneType' object has no attribute 'status_code'

saramsey commented 6 years ago

@dkoslicki are you using the latest version of this module? line 178 in the current version does not have "status_code = res.status_code"

dkoslicki commented 6 years ago

@saramsey looks like it's still there

dkoslicki commented 6 years ago

Where the changes pushed?

saramsey commented 6 years ago

Just to get this in the comment log; @dkoslicki is correct, I was looking at a local copy that was not committed. Sorry.

I have just pushed a fix -- commit 82bb76785048d2c61dee93539e17f9ea756838e5

dkoslicki commented 6 years ago

Looks like this is working now! It's hard to replicate a timeout to eUtils, but the code is running as intended with the changes you made, so I'll consider this closed.