From: SourceForge.net <no...@so...> - 2007-07-25 06:46:34
|
Bugs item #229368, was opened at 2001-01-19 06:18 Message generated for change (Comment added) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=229368&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Library Group: Deferred >Status: Closed >Resolution: Fixed Priority: 4 Private: No Submitted By: Finn Bock (bckfnn) Assigned to: Nobody/Anonymous (nobody) Summary: __getitem__ expected, but not defined for java exc. Initial Comment: >Traceback (innermost last): > File "FutureSourceSpider.py", line 86, in ? > File "c:\software\jython\Lib\urllib.py", line 68, in urlretrieve > File "c:\software\jython\Lib\urllib.py", line 198, in retrieve > File "c:\software\jython\Lib\urllib.py", line 169, in open > File "c:\software\jython\Lib\urllib.py", line 273, in open_http > File "c:\software\jython\Lib\httplib.py", line 430, in putrequest >AttributeError: __getitem__ > >The line throwing the error in inside an exception handler: > try: > self.send(str) > except socket.error, v: > # trap 'Broken pipe' if we're allowed to automatically >reconnect >>>>> if v[0] != 32 or not self.auto_open: <<<<< > raise > # try one more time (the socket was closed; this will >reopen) > self.send(str) > In CPython, the exception would have been a subclass of Exception, which defines a __getitem__ method. Index 0 would then contain the error number and index 1 an textual description. So the httplib will most likely work on CPython. OTOH, the java exception is just passed back from the jython socket module. This exception can not be indexed as a list, therefore we get the AttributeError: __getitem__. There is also no error number in a java exception. I'm not yet sure what the right long term solution is. Either httplib could test that the exception is a sequence before doing any indexing. Or the socket module could catch the java.net exception and reraise it as a SocketException. ---------------------------------------------------------------------- >Comment By: Charles Groves (cgroves) Date: 2007-07-25 01:46 Message: Logged In: YES user_id=1174327 Originator: NO The new socket module re-raises Java exceptions as Python exceptions, so this is fixed. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=229368&group_id=12867 |