Skip to content

Not overwriting MAST download of incomplete file #3231

Open
@eas342

Description

@eas342

I believe astroquery.mast should be able to download and write over an incomplete file. However, it still is corrupted/incomplete even when the code recognizes the file as incomplete. Here are the steps to re-produce.

from astroquery.mast import Observations
from astropy.io import fits
fileN = 'jw01185103001_02102_00001-seg001_nrcalong_rate.fits'
with open(fileN,'wb') as f:
    f.write(b'junk')
Observations.download_file('mast:jwst/product/'+fileN)
tmpHDU = fits.open(fileN)

I get OSError: Empty or corrupt FITS file whereas I was expecting astroquery to download a new file because it detects that the cached one is incomplete.

I'm using astroquery 0.4.10.dev9927 on Python 3.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions