您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

使用Bottle框架的Python粘贴破坏管道错误

5b51 2022/1/14 8:20:30 python 字数 2115 阅读 427 来源 www.jb51.cc/python

我正在使用实现WSGI请求和响应的Bottle框架,并且由于单线程问题,我将服务器更改为 PythonWSGIServer并使用Apache bench进行测试,但结果包含错误管道,与此问题 How to prevent errno 32 broken pipe?类似. 我已经尝试了答案但无济于事. Traceback (most recent call last): File "/Libra

概述

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/paste/httpserver.py",line 1068,in process_request_in_thread
    self.finish_request(request,client_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",line 323,in finish_request
    self.RequestHandlerClass(request,client_address,self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",line 641,in __init__
    self.finish()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py",line 694,in finish
    self.wfile.flush()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",line 303,in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

服务器代码如下所示,我不知道如何使用线程池改善连接?

from paste import httpserver

    @route('/')
    def index():
        connection = pymongo.MongoClient(connectionString)
        db = connection.test
        collection = db.test
        return str(collection.find_one())

    application = default_app()
    httpserver.serve(application,host='127.0.0.1',port=8082)

总结

以上是编程之家为你收集整理的使用Bottle框架的Python粘贴破坏管道错误全部内容,希望文章能够帮你解决使用Bottle框架的Python粘贴破坏管道错误所遇到的程序开发问题。


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶