BrokenPipeError: [Errno 32] Broken pipe

I created a visualization using plotly graph object (Not dash or plotly express).

Before showing the visualization in the browser, the python code has to process a lot of data and will take a little bit longer time than usual. That okay for me.

But, I am getting this broken pipe error. In StackOverflow , it says
`

This usually happens when you write to a socket fully closed on the other (client) side. This might be happening when a client program doesnโ€™t wait till all the data from the server is received and simply closes a socket (using the close function).

`

But, the client JS code is generated and I can#t have any control over that to make it wait for a bit longer.

What can be done in this situation?

Here is the complete error trace:

 Traceback (most recent call last):
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/socketserver.py", line 720, in __init__
    self.handle()
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/site-packages/plotly/io/_base_renderers.py", line 677, in do_GET
    self.wfile.write(html[i : i + bufferSize])
  File "/Users/mainulquraishi/opt/anaconda3/lib/python3.8/socketserver.py", line 799, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe

Hi @mainul thanks for posting. Did you find a solution?

Unfortunately no. I moved to use matplotlib to visualize a huge amount of data.
Also this answer is helpful. Although does not solve the problem but in the similar direction.