diff --git a/icepyx/core/Earthdata.py b/icepyx/core/Earthdata.py index f34be4063..dadc5955a 100644 --- a/icepyx/core/Earthdata.py +++ b/icepyx/core/Earthdata.py @@ -47,8 +47,12 @@ def __init__( def _start_session(self): #Request CMR token using Earthdata credentials token_api_url = 'https://cmr.earthdata.nasa.gov/legacy-services/rest/tokens' - hostname = socket.gethostname() - ip = socket.gethostbyname(hostname) + #try initially with machine hostname + #revert to using localhost if gaierror exception + try: + ip = socket.gethostbyname(socket.gethostname()) + except: + ip = socket.gethostbyname('localhost') data = {'token': {'username': self.uid, 'password': self.pswd,\ 'client_id': 'NSIDC_client_id','user_ip_address': ip}