Skip to content

Commit ca906ee

Browse files
committed
parent 0883e92
author Adam Ginsburg (keflavich) <[email protected]> 1660230509 -0400 committer Adam Ginsburg (keflavich) <[email protected]> 1661190088 -0400 attempt to fix broken downloader account for length-1 lists account for length-1 lists fix logic: the number of uids doesn't matter ,the number of files does the total size doesn't need to be filtered out cleverly, since things that aren't files don't have size
1 parent 0883e92 commit ca906ee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

astroquery/alma/core.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,15 @@ def retrieve_data_from_uid(self, uids, *, cache=True):
828828
raise TypeError("Datasets must be given as a list of strings.")
829829

830830
files = self.get_data_info(uids)
831-
file_urls = files['access_url']
831+
# filter out blank access URLs
832+
# it is possible for there to be length-1 lists
833+
if len(files) == 1:
834+
file_urls = files['access_url']
835+
if isinstance(file_urls, str) and file_urls == '':
836+
raise ValueError(f"Cannot download uid {uid} because it has no file")
837+
else:
838+
file_urls = [url for url in files['access_url'] if url]
839+
832840
totalsize = files['content_length'].sum()*u.B
833841

834842
# each_size, totalsize = self.data_size(files)

0 commit comments

Comments
 (0)