From 5cb9c1844ac7dfef04a57c8a80eedd5eba86f3bb Mon Sep 17 00:00:00 2001 From: Abdu Zoghbi Date: Mon, 16 Oct 2023 17:21:03 -0400 Subject: [PATCH] attempt to fix windows CI --- pyvo/utils/download.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyvo/utils/download.py b/pyvo/utils/download.py index e14be3f69..450256f09 100644 --- a/pyvo/utils/download.py +++ b/pyvo/utils/download.py @@ -69,7 +69,9 @@ def http_download(url, length = None if cache and os.path.exists(local_filepath): - local_size = os.stat(local_filepath).st_size + with open(local_filepath, 'rb'): + fp.seek(0, os.SEEK_END) + local_size = fp.tell() if length is not None and local_size != length: warn('Found cached file but it has the wrong size. Overwriting ...', category=PyvoUserWarning) @@ -234,8 +236,10 @@ def aws_download(uri=None, if cache and os.path.exists(local_filepath): if length is not None: - statinfo = os.stat(local_filepath) - if statinfo.st_size == length: + with open(local_filepath, 'rb'): + fp.seek(0, os.SEEK_END) + local_size = fp.tell() + if local_size == length: # found cached file with expected size. Stop if verbose: print(f'Found cached file {local_filepath}.')