error: [Errno 104] Connection reset by peer

364 views
Skip to first unread message

Jerome de Leon

unread,
Nov 7, 2016, 5:40:19 AM11/7/16
to astroML-general
When I do:
$ from astroML.datasets import fetch_imaging_sample
$ data = fetch_imaging_sample()

I receive the following error (full details below): 
error: [Errno 104] Connection reset by peer

suggested to do:
from socket import error as SocketError
import errno

try:
    response = urllib2.urlopen(request).read()
except SocketError as e:
    if e.errno != errno.ECONNRESET:
        raise # Not error we are looking for
    pass # Handle error here.

Is this commendable? Thank you!

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-3-bf612951910b> in <module>()
----> 1 data = fetch_imaging_sample()

/home/dl/miniconda2/envs/astroconda/lib/python2.7/site-packages/astroML/datasets/imaging_sample.pyc in fetch_imaging_sample(data_home, download_if_missing)
    107                           'set download_if_missing=True to download')
    108 
--> 109         fitsdata = download_with_progress_bar(DATA_URL)
    110         open(archive_file, 'wb').write(fitsdata)
    111 

/home/dl/miniconda2/envs/astroconda/lib/python2.7/site-packages/astroML/datasets/tools/download.pyc in download_with_progress_bar(data_url, return_buffer)
     39     num_units = 40
     40 
---> 41     fhandle = urlopen(data_url)
     42     content_length = url_content_length(fhandle)
     43 

/home/dl/miniconda2/envs/astroconda/lib/python2.7/urllib2.pyc in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    152     else:
    153         opener = _opener
--> 154     return opener.open(url, data, timeout)
    155 
    156 def install_opener(opener):

/home/dl/miniconda2/envs/astroconda/lib/python2.7/urllib2.pyc in open(self, fullurl, data, timeout)
    429             req = meth(req)
    430 
--> 431         response = self._open(req, data)
    432 
    433         # post-process response

/home/dl/miniconda2/envs/astroconda/lib/python2.7/urllib2.pyc in _open(self, req, data)
    447         protocol = req.get_type()
    448         result = self._call_chain(self.handle_open, protocol, protocol +
--> 449                                   '_open', req)
    450         if result:
    451             return result

/home/dl/miniconda2/envs/astroconda/lib/python2.7/urllib2.pyc in _call_chain(self, chain, kind, meth_name, *args)
    407             func = getattr(handler, meth_name)
    408 
--> 409             result = func(*args)
    410             if result is not None:
    411                 return result

/home/dl/miniconda2/envs/astroconda/lib/python2.7/urllib2.pyc in http_open(self, req)
   1225 
   1226     def http_open(self, req):
-> 1227         return self.do_open(httplib.HTTPConnection, req)
   1228 
   1229     http_request = AbstractHTTPHandler.do_request_

/home/dl/miniconda2/envs/astroconda/lib/python2.7/urllib2.pyc in do_open(self, http_class, req, **http_conn_args)
   1198         else:
   1199             try:
-> 1200                 r = h.getresponse(buffering=True)
   1201             except TypeError: # buffering kw not supported
   1202                 r = h.getresponse()

/home/dl/miniconda2/envs/astroconda/lib/python2.7/httplib.pyc in getresponse(self, buffering)
   1134 
   1135         try:
-> 1136             response.begin()
   1137             assert response.will_close != _UNKNOWN
   1138             self.__state = _CS_IDLE

/home/dl/miniconda2/envs/astroconda/lib/python2.7/httplib.pyc in begin(self)
    451         # read until we get a non-100 response
    452         while True:
--> 453             version, status, reason = self._read_status()
    454             if status != CONTINUE:
    455                 break

/home/dl/miniconda2/envs/astroconda/lib/python2.7/httplib.pyc in _read_status(self)
    407     def _read_status(self):
    408         # Initialize with Simple-Response defaults
--> 409         line = self.fp.readline(_MAXLINE + 1)
    410         if len(line) > _MAXLINE:
    411             raise LineTooLong("header line")

/home/dl/miniconda2/envs/astroconda/lib/python2.7/socket.pyc in readline(self, size)
    478             while True:
    479                 try:
--> 480                     data = self._sock.recv(self._rbufsize)
    481                 except error, e:
    482                     if e.args[0] == EINTR:

error: [Errno 104] Connection reset by peer

Jake Vanderplas

unread,
Nov 7, 2016, 9:53:36 AM11/7/16
to Jerome de Leon, astroML-general
Hi,
Some of the dataset fetching routines currently don't work because of changing architecture/URLs of data sources. I'm hoping to address this in the coming months, but it's a relatively large undertaking when combined with all the other dependency changes is astroML. There's nobody else to help me in this, and I have a full time job and a family to distract me from the task :)

We're putting in an NSF grant this week to hopefully support some maintenance and improvement of the package, so keep your fingers crossed.

Sorry I can't be more helpful at the moment,
   Jake

--
You received this message because you are subscribed to the Google Groups "astroML-general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to astroml-general+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages