Python论坛  - 讨论区

标题:Re: [python-chinese] ÔõôµÃµ½httplib µÄÒì³£ÄØ£¿

2005年02月21日 星期一 12:22

limodou limodou at gmail.com
Mon Feb 21 12:22:48 HKT 2005

捕获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


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号