Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodename nor servname provided, or not known? #97

Closed
bradlipovsky opened this issue Jul 6, 2020 · 0 comments · Fixed by #98 or #163
Closed

nodename nor servname provided, or not known? #97

bradlipovsky opened this issue Jul 6, 2020 · 0 comments · Fixed by #98 or #163
Assignees
Labels
bug Something isn't working

Comments

@bradlipovsky
Copy link

Hello!

The following code works on the Hackweek Pangeo but not on my personal computer.

import os
import shutil
import h5py
import matplotlib.pyplot as plt
from icepyx import icesat2data as ipd

short_name = 'ATL06'
spatial_extent = [31.5, -70.56, 33.73, -69.29]
date_range = ['2020-03-30','2020-04-1']
region_a = ipd.Icesat2Data(short_name, spatial_extent, date_range)

earthdata_uid = 'therealbradlipovsky'
email = 'brad_lipovsky@fas.harvard.edu'
region_a.earthdata_login(earthdata_uid, email)
region_a.download_granules('/home/jovyan/data') 

When run on my personal computer, I get the following error. Am I doing something incorrectly?

Thanks!

Brad

---------------------------------------------------------------------------
gaierror                                  Traceback (most recent call last)
~/Google Drive/Science/icepyx/icepyx/core/Earthdata.py in login(self)
    106             self.uid,_,self.pswd = netrc.netrc(self.netrc).authenticators(url)
--> 107             session = self._start_session()
    108 

~/Google Drive/Science/icepyx/icepyx/core/Earthdata.py in _start_session(self)
     50         hostname = socket.gethostname()
---> 51         ip = socket.gethostbyname(hostname)
     52 

gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

gaierror                                  Traceback (most recent call last)
<ipython-input-13-0400ac4c047b> in <module>
     12 earthdata_uid = 'therealbradlipovsky'
     13 email = 'brad_lipovsky@fas.harvard.edu'
---> 14 region_a.earthdata_login(earthdata_uid, email)
     15 region_a.download_granules('/home/jovyan/data')

~/Google Drive/Science/icepyx/icepyx/core/icesat2data.py in earthdata_login(self, uid, email)
    572 
    573         capability_url = f'https://n5eil02u.ecs.nsidc.org/egi/capabilities/{self.dataset}.{self._version}.xml'
--> 574         self._session = Earthdata(uid,email,capability_url).login()
    575         self._email = email
    576 

~/Google Drive/Science/icepyx/icepyx/core/Earthdata.py in login(self)
    111             for i in range(5):
    112                 try:
--> 113                     session = self._start_session()
    114                     break
    115                 except KeyError:

~/Google Drive/Science/icepyx/icepyx/core/Earthdata.py in _start_session(self)
     49         token_api_url = 'https://cmr.earthdata.nasa.gov/legacy-services/rest/tokens'
     50         hostname = socket.gethostname()
---> 51         ip = socket.gethostbyname(hostname)
     52 
     53         data = {'token': {'username': self.uid, 'password': self.pswd,\

gaierror: [Errno 8] nodename nor servname provided, or not known
@tsutterley tsutterley self-assigned this Jul 6, 2020
tsutterley added a commit that referenced this issue Jul 6, 2020
mac OS upgrades can lead to machines unable to get IP from hostname.  this is a fix to revert to using 'localhost' in case of a gaierror from socket.gethostbyname
@JessicaS11 JessicaS11 added the bug Something isn't working label Jul 6, 2020
JessicaS11 pushed a commit that referenced this issue Jul 6, 2020
mac OS upgrades can lead to machines unable to get IP from hostname.  this is a fix to revert to using 'localhost' in case of a gaierror from socket.gethostbyname
@JessicaS11 JessicaS11 linked a pull request Jul 6, 2020 that will close this issue
weiji14 pushed a commit that referenced this issue Aug 30, 2020
mac OS upgrades can lead to machines unable to get IP from hostname.  this is a fix to revert to using 'localhost' in case of a gaierror from socket.gethostbyname
JessicaS11 pushed a commit that referenced this issue Sep 10, 2020
mac OS upgrades can lead to machines unable to get IP from hostname.  this is a fix to revert to using 'localhost' in case of a gaierror from socket.gethostbyname
@JessicaS11 JessicaS11 linked a pull request Jan 20, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants