Closed xapple closed 2 years ago
Thanks for catching this! I can confirm that this is a bug. cc @bscrow
I could not reproduce this bug in Python 3.7 (see colab example) where the query "cancer human" returns no search results with a message as expected:
No results found for the following search query: {'query': 'CANCER HUMAN', 'accession': None, 'organism': None, 'layout': None, 'mbases': None, 'publication_date': None, 'platform': None, 'selection': None, 'source': None, 'strategy': None, 'title': None}
The traceback suggests an error when calling r.json() on an empty query result. Can I check what version of requests
library are you using?
Version '2.27.1' which is the latest at time of writing. But I'm on python 3.9.9, so I'm going to guess something changed with the built-in json
module between versions.
I just tried this with Python 3.10.2 and requests 2.27.1 and was unable to replicate as well:
$ python
Python 3.10.2 | packaged by conda-forge | (main, Feb 1 2022, 19:29:00) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysradb.search import EnaSearch
>>> instance = EnaSearch(query="cancer human")
>>> instance.search()
No results found for the following search query:
{'query': 'CANCER HUMAN', 'accession': None, 'organism': None, 'layout': None, 'mbases': None, 'publication_date': None, 'platform': None, 'selection': None, 'source': None, 'strategy': None, 'title': None}
>>> df = instance.get_df()
>>> print(df)
Empty DataFrame
Columns: []
Index: []
Can you try again @xapple? Not sure if it might be due to an intermittent connectivity issue?
I installed and upgraded the latest pythons on my computer:
I can confirm that the problem is present only in 3.9 series and not in 3.10
Indeed, we see this on the tests also: https://github.com/saketkc/pysradb/runs/5465673995?check_suite_focus=true#step:7:76. But looks like a recent problem (like a couple of weeks old), since the earlier tests pass with 3.9: https://github.com/saketkc/pysradb/runs/5309144937?check_suite_focus=true
Describe the bug The
EnaSearch
sometimes returns aJSONDecodeError
depending on what search terms were entered.To Reproduce Here are two examples, one where it works, one where it doesn't. The search term is 'human cancer' in the first and 'cancer human' in the second.
Desktop (please complete the following information):