kblin / ncbi-acc-download

Download files from NCBI Entrez by accession
Apache License 2.0
111 stars 8 forks source link

Better user-facing messages on invalid IDs #1

Open areejalsheikh opened 6 years ago

areejalsheikh commented 6 years ago

Hi,

Thanks for this awesome tool. Could you please help with the following error?

I just tried to run the command in the README

ncbi-acc-download AB_12345

but I got the error:

raise DownloadError("Download failed with return code: {}".format(r.status_code))

ncbi_acc_download.core.DownloadError: Download failed with return code: 400

No problems showing the help message ncbi-acc-download -h.

Thanks, Areej

kblin commented 6 years ago

Hi there,

Sorry I missed this issue before. AB_12345 is just a made up ID I use as an example. If you use a real GenBank or RefSeq ID, that should work. E.g. ncbi-acc-download NC_003888 should download the Streptomyces coelicolor genome.

tseemann commented 5 years ago

Can you not print the giant traceback? The error is clear, but lost amongst the noise.

% ncbi-acc-download GCA_001691195.1

Failed to download file with id GCA_001691195.1 from NCBI
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/bin/ncbi-acc-download", line 11, in <module>
    load_entry_point('ncbi-acc-download==0.2.5', 'console_scripts', 'ncbi-acc-download')()
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/ncbi_acc_download/__main__.py", line 54, in main
    download_to_file(dl_id, config, filename, append)
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/ncbi_acc_download/core.py", line 110, in download_to_file
    r = get_stream(url, params)
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/ncbi_acc_download/download.py", line 90, in get_stream
    raise DownloadError("Download failed with return code: {}".format(r.status_code))
ncbi_acc_download.errors.DownloadError: Download failed with return code: 400