Skip to content

Commit

Permalink
Added check if CRDS Readonly environment variable is set
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSkyentist committed Dec 13, 2023
1 parent 44d48fd commit f9b86c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions grizli/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -6224,9 +6224,8 @@ def get_jwst_wfssbkg_file(file, valid_flat=[0.6, 1.3], make_figure=False):

flat_file = FlatFieldStep().get_reference_file(file, 'flat')

# If we have write access to file open it
# Otherwise copy to local file
if not os.access(bkg_file,os.W_OK):
# If we don't have write access copy to local file
if (not os.access(bkg_file,os.W_OK)) or (('CRDS_READONLY_CACHE' in os.environ) and (os.environ['CRDS_READONLY_CACHE'] == '1')):
shutil.copy(bkg_file,local_bkg_file)
bkg_file = local_bkg_file
wf = pyfits.open(bkg_file, mode='update')
Expand Down

0 comments on commit f9b86c3

Please sign in to comment.