[Python-es] Error de sockets usando urllib2

Olemis Lang (Simelix) olemis+py en gmail.com
Jue Feb 18 15:16:23 CET 2010


2010/2/15 Olemis Lang (Simelix) <olemis+py en gmail.com>:
> Muy brevemente el problema es el siguiente.

Alguna idea al respecto ? Realmente no tengo la más mínima idea de por
qué es que esto ocurre ...

:-/

> Trato de utilizar
> HessianPy (RPC ;o).
> Cuando trato de efectuar una llamada a un procedimiento remoto desde una PC
> (especie de servidor de prueba ;o) con Windows XP, me lanza un error
> URLError 11001
>
> {{{
> #!python
>
>>>> sys.version_info
> (2, 5, 2, 'final', 0)
>>>> from hessian.client import HessianProxy as HSP
>>>> hp = HSP('http://127.0.0.1/hessian', None)
>>>> getattr(hp, 'system.getAPIVersion')()
> request ['63', '01', '00', '6d', '00', '14', '73', '79', '73', '74',
> '65', '6d', '2e', '67', '65', '74', '41', '50', '49', '56', '65',
> '72', '73', '69', '6f', '6e', '7a']
>        : c? m ¶system.getAPIVersionz
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "c:\program
> files\python\2.5\lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\client.py",
> line 59, in __call__
>    return self.invoker(self.method, args)
>  File "c:\program
> files\python\2.5\lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\client.py",
> line 87, in __invoke
>    response = self._transport.request(request)
>  File "C:\Program
> Files\Python\2.5\lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\transports.py",
> line 120, in request
>    response = self._opener.open(r)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 381, in open
>    response = self._open(req, data)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 399, in _open
>    '_open', req)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 360, in _call_chain
>    result = func(*args)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 1107, in http_open
>    return self.do_open(httplib.HTTPConnection, req)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 1082, in do_open
>    raise URLError(err)
> urllib2.URLError: <urlopen error (11001, 'getaddrinfo failed')>
>
> }}}
>
> Por tanto traté de ejecutar la «suite de pruebas» (hessian.test.test)
> desde la línea de comandos y obtengo errores muy parecidos
>
> {{{
> #!sh
>
> C:\>python "C:\Program
> Files\Python\2.5\Lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\test\test.py"
> . . . . . . . .
> Starting test HTTP server
> Serving from  ('localhost', 7777)
>
> Error occurred:
> Traceback (most recent call last):
>  File "C:\Program
> Files\Python\2.5\Lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\test\test.py",
> line 396, in <module>
>    sslTest
>  File "C:\Program
> Files\Python\2.5\Lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\test\test.py",
> line 381, in runList
>    fn()
>  File "C:\Program
> Files\Python\2.5\Lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\test\test.py",
> line 395, in <lambda>
>    lambda: callTestLocal("http://localhost:%d/" % TEST_PORT),
>  File "C:\Program
> Files\Python\2.5\Lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\test\test.py",
> line 294, in callTestLocal
>    msg = proxy.nothing()
>  File "c:\program
> files\python\2.5\lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\client.py",
> line 59, in __call__
>    return self.invoker(self.method, args)
>  File "c:\program
> files\python\2.5\lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\client.py",
> line 87, in __invoke
>    response = self._transport.request(request)
>  File "C:\Program
> Files\Python\2.5\lib\site-packages\hessianpy-1.0.4-py2.5.egg\hessian\transports.py",
> line 120, in request
>    response = self._opener.open(r)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 381, in open
>    response = self._open(req, data)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 399, in _open
>    '_open', req)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 360, in _call_chain
>    result = func(*args)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 1107, in http_open
>    return self.do_open(httplib.HTTPConnection, req)
>  File "C:\Program Files\Python\2.5\lib\urllib2.py", line 1082, in do_open
>    raise URLError(err)
> URLError: <urlopen error (11001, 'getaddrinfo failed')>
>
> }}}
>
> Habilité logging en el servidor y la llamada (i.e. la petición) no
> llega (i.e. HessianPy no está enviando nada). Hasta ahora nbo he
> detectado la causa pero estoy 90% convencido que se trata del cliente
> de HessianPy
>
> Q:
>  - Alguien ha tenido errores semejantes anteriormente ?
>  - Qué es lo que pudiera estar mal ?
>  - Cómo arreglarlo ?
>
> Cualquier ayuda será muy bienvenida .
>
> Gracias por adelantado.
>
> PS: Aquí les envío el código del cliente de HessianPy [1]_ (más bien
> del transporte HTTP ;o) para ver si les ayuda a generar alguna idea
>
> .. [1] hessian.client.HessianProxy
>         (http://simelo.pastebin.com/f25bc4b18)

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
Fixed 3 bugs identified by Steffen Pingel (from Mylyn test suite), and
also added a test case...  -
http://bitbucket.org/osimons/trac-rpc-mq/changeset/ba2572404912/



Más información sobre la lista de distribución Python-es