求助!关于Bottle+python运行时错误的问题,详情请进

iscien 2013-06-13 08:41:03
环境python 3.3.2+bottle 0.11.6+win7 专业版
刚开始学python 和bottle ,用pip安装了bottle,试着写了一个小程序,有一段时间还一切OK,但最近发现第一次打开的时候很长时间没有反应,重新刷新一次就OK了,但终端出现好多的错误提示。电脑没有其它变化,bottle是用pip安装的。
将debug=True改为False之后依然如故,请各位指点,多谢!
from bottle import route,run

@route('/')
def hello():
return "Hello World!"

run(host='localhost', port=8080, debug=True)


Bottle v0.11.6 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

127.0.0.1 - - [13/Jun/2013 20:26:45] "GET / HTTP/1.1" 200 12
127.0.0.1 - - [13/Jun/2013 20:26:45] "GET / HTTP/1.1" 200 12
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python33\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接。
127.0.0.1 - - [13/Jun/2013 20:26:45] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 50822)
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python33\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python33\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python33\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python33\lib\socketserver.py", line 306, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 332, in process_request
self.finish_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python33\lib\socketserver.py", line 666, in __init__
self.handle()
File "C:\Python33\lib\wsgiref\simple_server.py", line 126, in handle
handler.run(self.server.get_app())
File "C:\Python33\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python33\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
...全文
412 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
php_yaojin 2014-12-18
  • 打赏
  • 举报
回复
我也遇到这个问题了 怎么解决呀
iscien 2013-06-15
  • 打赏
  • 举报
回复
奇怪今天在WinXP下试一试却一切正常,难道是win7的问题?
panghuhu250 2013-06-14
  • 打赏
  • 举报
回复
详细讲讲怎么才能触发你得到的异常。我这儿允许你的程序没有任何问题。

37,720

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧