2005年02月21日 星期一 12:22
捕获Exception 不要httplib.HTTPException 试试 On Mon, 21 Feb 2005 12:5:36 +0800, cry <zyqmail at 163.net> wrote: > python,您好! > > 我做了如下的代码: > try: > conn = httplib.HTTPConnection("192.168.1.103") > conn.request("GET", "/") > response = conn.getresponse() > result = response.read() > conn.close() > except httplib.HTTPException , msg: > print msg > > 运行后: > Traceback (most recent call last): > File "", line 3, in ? > File "I:\Python23\lib\httplib.py", line 718, in request > self._send_request(method, url, body, headers) > File "I:\Python23\lib\httplib.py", line 739, in _send_request > self.endheaders() > File "I:\Python23\lib\httplib.py", line 712, in endheaders > self._send_output() > File "I:\Python23\lib\httplib.py", line 597, in _send_output > self.send(msg) > File "I:\Python23\lib\httplib.py", line 564, in send > self.connect() > File "I:\Python23\lib\httplib.py", line 532, in connect > socket.SOCK_STREAM): > error: (10060, 'Operation timed out') > > 错在那里呢?我怎么能控制httplib的exception呢? > 我这样处理ftplib就可以。 > > 谢谢。 > > 致 > 礼! > > cry > zyqmail at 163.net > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -- I like python! My Blog: http://www.donews.net/limodou New Maillist: http://groups-beta.google.com/group/python-cn
Zeuux © 2025
京ICP备05028076号