Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 线程服务器断开管道错误_Python_Python 2.7_Python Unittest_Broken Pipe - Fatal编程技术网

Python 线程服务器断开管道错误

Python 线程服务器断开管道错误,python,python-2.7,python-unittest,broken-pipe,Python,Python 2.7,Python Unittest,Broken Pipe,我已经安装了SimpleServer。现在我想用unittest测试它。在test.py文件中,我有一个类test(unittest.TestCase) 运行代码时,其中一个测试出现断管错误: File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/S

我已经安装了SimpleServer。现在我想用unittest测试它。在test.py文件中,我有一个类test(unittest.TestCase)

运行代码时,其中一个测试出现断管错误:

File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
self.wfile.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

若我从一个地方运行服务器,并从另一个地方执行unittest,那个么并没有错误。在整个过程中,两侧的连接都处于打开状态。问题出在哪里?

在再次运行脚本之前,您可以等待几分钟。您是否使用了一些不寻常的网络技术,如多播?class ThreadedSimpleServer(SocketServer.ThreadingMixIn,HTTPServer):通过。类RequestHandler(SimpleHTTPRequestHandler):。ThreadedSimpleServer(地址,RequestHandler)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
self.wfile.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe