AstarVienna/ScopeSim

Replace astropy.utils.data.download_file with httpx

Closed this issue ยท 8 comments

download_file() from astropy.utils.data can lead to various Exceptions with the univie webserver, e.g.

urllib.error.ContentTooShortError: <urlopen error File was supposed to be 10713600 bytes but we only got 10713359 bytes. Download failed.

This bothers end users, and makes our tests fail unreliably.

Replacing download_file() with equivalent functionality from httpx with proper retry functions seems to 'fix' this problem. So we should use that everywhere.

Places where we use download_file():

So this issue transcends just ScopeSim.

Maybe some of those might also be better off using pooch, especially that one notebook. See also AstarVienna/speXtra#10

Thanks, pooch seems a nice way to fetch things. Assuming it doesn't have the same problem..

Thanks, pooch seems a nice way to fetch things. Assuming it doesn't have the same problem..

Done with #446 I guess. I forgot we already had the pooch conversation half a year ago ๐Ÿ˜‚

The one in ScopeSim_Templates was removed in AstarVienna/ScopeSim_Templates#88.

The one in the MICADO notebook was removed in AstarVienna/irdb#185

4 down, 2 to go ๐Ÿš€

The one with TER curves utils was addressed and removed in #454

The Pyckles one was replaced in AstarVienna/Pyckles#9