sbonaime / seedlink_plotter

Seedlink_plotter A python script to plot real time seismic data from a seedlink server
GNU Lesser General Public License v3.0
36 stars 19 forks source link

urlopen error timed out with get_event #5

Closed sbonaime closed 11 years ago

sbonaime commented 11 years ago

After few ours of test, I get this error

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 530, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.7/threading.py", line 483, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./seedlink_plotter.py", line 187, in run
    events = self.get_events()
  File "./seedlink_plotter.py", line 204, in get_events
    min_magnitude=self.args.events)
  File "/usr/local/lib/python2.7/site-packages/obspy-0.0.0_tar_zipball-py2.7-linux-x86_64.egg/obspy/neries/client.py", line 82, in wrapper
    v = f(*args, **new_kwargs)
  File "/usr/local/lib/python2.7/site-packages/obspy-0.0.0_tar_zipball-py2.7-linux-x86_64.egg/obspy/neries/client.py", line 280, in getEvents
    data = self._fetch("/services/event/search", **kwargs)
  File "/usr/local/lib/python2.7/site-packages/obspy-0.0.0_tar_zipball-py2.7-linux-x86_64.egg/obspy/neries/client.py", line 161, in _fetch
    response = urllib2.urlopen(remoteaddr, timeout=self.timeout)
  File "/usr/lib64/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib64/python2.7/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.7/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib64/python2.7/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.7/urllib2.py", line 1189, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib64/python2.7/urllib2.py", line 1164, in do_open
    raise URLError(err)
URLError: <urlopen error timed out>
sbonaime commented 11 years ago

After 24h of testing with a non reliable wifi connection I got those messages: URLError: URLError: URLError: URLError: URLError: URLError:

Your commit solves the problem. I think we can remove the error message or create a debug flag to display error messages. What do you think ?

megies commented 11 years ago

Good to hear. Interesting, I usually got this <urlopen error timed out> as the Exception message (seems empty in your case). Anyway, for now I would just leave it in, maybe. What I would think more important would be to recognize from the plot that the events were not updated (e.g. plot some tiny red X in the lower right corner or some text "event update failed" or something similar).

Normally, the whole program would probably be run as something like a daemon in background, so at some point it would probably be nice to switch to the logging module and properly log to a file (or stdout if given a flag on startup). However, I think this is overkill at this stage.. ;)