poppy-project/pypot

snap doesn't start offline

jjehl opened this issue · 2 comments

jjehl commented

Because there is a call to google ip. snap server raise an error if you are offline (not connected to internet) and you want to launch snap.

c:\python27\lib\site-packages\pypot-2.11.8-py2.7.egg\pypot\server\snap.pyc in find_local_ip(host)
50 with closing(socket.socket()) as s:
51 s.settimeout(1)
---> 52 s.connect(('8.8.8.8', 53))
53 return s.getsockname()[0]
54 except socket.timeout:

c:\python27\lib\socket.pyc in meth(name, self, _args)
222
223 def meth(name,self,_args):
--> 224 return getattr(self._sock,name)(*args)
225
226 for _m in _socketmethods:

error: [Errno 10065] Une opération a été tentée sur un hôte impossible à atteindre

Can be solve easyly with an except : pass

It seems to be a socket error very specific to windows.
Catching all exceptions is really a bad thing, you should avoid it.

I tried a bug fix in #215, could you try this branch (I have no windows computer under the hand) ?

jjehl commented

Yes better to avoid catching all exceptions even if it is simple !! Your fix works like a charm.