jgomezdans / get_modis

Downloading MODIS data from the USGS repository
GNU General Public License v3.0
62 stars 41 forks source link

urllib2.URLError: <urlopen error [Errno 8] _ssl.c:504: EOF occurred in violation of protocol> #10

Open jesselangdon opened 6 years ago

jesselangdon commented 6 years ago

Thanks for this great tool! I am using get_modis as a submodule in my own repo (STeAMM), and recently updated to the latest version, and while testing, I encountered this error:

  File "C:\dev\STeAMM\STeAMM\externals\get_modis\get_modis.py", line 249, in get_modisfiles
    dates = parse_modis_dates(url, dates, product, out_dir, ruff=ruff)
  File "C:\dev\STeAMM\STeAMM\externals\get_modis\get_modis.py", line 143, in parse_modis_dates
    html = return_url(url)
  File "C:\dev\STeAMM\STeAMM\externals\get_modis\get_modis.py", line 105, in return_url
    html = urllib2.urlopen(req).readlines()
  File "C:\OSGeo4W\apps\Python27\lib\urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\OSGeo4W\apps\Python27\lib\urllib2.py", line 404, in open
    response = self._open(req, data)
  File "C:\OSGeo4W\apps\Python27\lib\urllib2.py", line 422, in _open
    '_open', req)
  File "C:\OSGeo4W\apps\Python27\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "C:\OSGeo4W\apps\Python27\lib\urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "C:\OSGeo4W\apps\Python27\lib\urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 8] _ssl.c:504: EOF occurred in violation of protocol>

When I call the get_modis function, I use the default base_url (i.e. "http://e4ftl01.cr.usgs.gov"), so I'm not sure what's going on (I'm a bit of a noob). I'm assuming there's something weird going on with the urllib2 module's use of the SSL protocol, but I'm not sure what exactly.

Here are the parameters being supplied to the parse_modis_dates function (line 249):

dates = ['2015.01.01', '2015.01.02', '2015.01.03', '2015.01.04', '2015.01.05', '2015.01.06', '2015.01.07', '2015.01.08']
out_dir = '.'
product = 'MOD11A1.005'
ruff = False
url = ''http://e4ftl01.cr.usgs.gov/MOLT/MOD11A1.005/''