Skip to content

Commit

Permalink
[auxdata.get_egm_lookup] avoid OSError if PROJ_LIB is read-only
Browse files Browse the repository at this point in the history
fixes #183
  • Loading branch information
johntruckenbrodt committed Jan 7, 2022
1 parent 2a1b352 commit dd55d30
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pyroSAR/auxdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,11 +915,10 @@ def get_egm_lookup(geoid, software):

proj_lib = os.environ.get('PROJ_LIB')
if proj_lib is not None:
if not os.access(proj_lib, os.W_OK):
raise OSError("cannot write to 'PROJ_LIB' path: {}".format(proj_lib))

gtx_local = os.path.join(proj_lib, os.path.basename(gtx_remote))
if not os.path.isfile(gtx_local):
if not os.access(proj_lib, os.W_OK):
raise OSError("cannot write to 'PROJ_LIB' path: {}".format(proj_lib))
log.info('{} <<-- {}'.format(gtx_local, gtx_remote))
r = requests.get(gtx_remote)
r.raise_for_status()
Expand Down

0 comments on commit dd55d30

Please sign in to comment.