Skip to content

Commit

Permalink
attempt to fix windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
zoghbi-a committed Oct 16, 2023
1 parent ef906c9 commit 5cb9c18
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyvo/utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}.')
Expand Down

0 comments on commit 5cb9c18

Please sign in to comment.