skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.41k stars 211 forks source link

.download* files should be removed if the download fails #625

Open homuhumushomu opened 3 years ago

homuhumushomu commented 3 years ago

I see some files with .download extension (e.g. de406.bsp.download). Are these temporary files/failed downloads? Can they be removed?

brandon-rhodes commented 3 years ago

Yes! They can be removed. I wonder if the download logic should remove them automatically? I haven't read through that code in a long time.

brandon-rhodes commented 3 years ago

(But: they should be re-used when you then download the file successfully, and disappear. So I think they're only an issue if you stop a download, then decide to give up on downloading that file? I had assumed that would be rare among users, and that folks would simply re-try till they the file had been fetched successfully.)

homuhumushomu commented 3 years ago

That does not seem to be the case. Take a look at my FS

-rw-r--r--   1 user  32000   5.5M May 21 19:45 hip_main.dat.download
-rw-r--r--   1 user  32000    13M May 21 19:48 hip_main.dat.download2
-rw-r--r--   1 user  32000    51M May 21 19:56 hip_main.dat

So it seems that it was not able to resume the downloading and just started over.

brandon-rhodes commented 3 years ago

Oh — I suppose, because of the need to make Skyfield safe if several copies of a script are running at once, that I made the code make sure it was using a separate .download file.

Yes! The old ones can be removed.

If you would like, you could edit this issue's title to ask that .download* files be removed if the download fails.

homuhumushomu commented 3 years ago

thanks for the info.