Noticed a message at jython.org that RC 1 is out (great stuff!!) and immediately run our projects acceptance tests against it. Noticed only one small regression when trying to use urllib.urlopen to access something on a non-existing host. There used to be an IOError but now you get a java.net.UnknownHostException (which goes through if you are excepting IOError or any Python based exception). Details about this on Jython 2.2b1 and RC1 as well as on Python 2.5 are below.
Note that doing urllib.urlopen('nonexisting') causes an IOError also on RC1 i.e. the problem appears only when you specify the protocol.
Based on the stacktrace this seems to be somehow related to new socket/select implementation (which I hardly can wait to test with telnetlib). If so, the same problem can appear also in other places when trying to open non-existing/not-available network resources.
Jython 2.2rc1 on java1.5.0_11
Type "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.urlopen('http://nonexisting')
Traceback (innermost last):
File "<console>", line 1, in ?
File "C:\jython2.2rc1\Lib\urllib.py", line 73, in urlopen
File "C:\jython2.2rc1\Lib\urllib.py", line 178, in open
File "C:\jython2.2rc1\Lib\urllib.py", line 292, in open_http
File "C:\jython2.2rc1\Lib\httplib.py", line 699, in endheaders
File "C:\jython2.2rc1\Lib\httplib.py", line 585, in _send_output
File "C:\jython2.2rc1\Lib\httplib.py", line 552, in send
File "C:\jython2.2rc1\Lib\httplib.py", line 519, in connect
File "C:\jython2.2rc1\Lib\socket.py", line 319, in getaddrinfo
File "C:\jython2.2rc1\Lib\socket.py", line 290, in gethostbyname
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.net.UnknownHostException: java.net.UnknownHostException: nonexisting: nonex
isting
>>>
Jython 2.2b1 on java1.5.0_10 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.urlopen('http://nonexisting')
Traceback (innermost last):
File "<console>", line 1, in ?
File "C:\jython2.2b1\Lib\urllib.py", line 73, in urlopen
File "C:\jython2.2b1\Lib\urllib.py", line 178, in open
File "C:\jython2.2b1\Lib\urllib.py", line 292, in open_http
File "C:\jython2.2b1\Lib\httplib.py", line 699, in endheaders
File "C:\jython2.2b1\Lib\httplib.py", line 585, in _send_output
File "C:\jython2.2b1\Lib\httplib.py", line 552, in send
File "C:\jython2.2b1\Lib\httplib.py", line 519, in connect
File "C:\jython2.2b1\Lib\socket.py", line 83, in getaddrinfo
File "C:\jython2.2b1\Lib\socket.py", line 67, in gethostbyname
IOError: [Errno socket error] java.net.UnknownHostException: nonexisting: nonexi
sting
>>>
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on wi
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.urlopen('http://nonexisting')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python25\lib\urllib.py", line 82, in urlopen
return opener.open(url)
File "c:\Python25\lib\urllib.py", line 190, in open
return getattr(self, name)(url)
File "c:\Python25\lib\urllib.py", line 325, in open_http
h.endheaders()
File "c:\Python25\lib\httplib.py", line 856, in endheaders
self._send_output()
File "c:\Python25\lib\httplib.py", line 728, in _send_output
self.send(msg)
File "c:\Python25\lib\httplib.py", line 695, in send
self.connect()
File "c:\Python25\lib\httplib.py", line 663, in connect
socket.SOCK_STREAM):
IOError: [Errno socket error] (11001, 'getaddrinfo failed')
>>> |