Skip to content

Piping the results of mypy to head can result in a broken pipe error #2893

Closed
@w0rp

Description

@w0rp

I have been working on getting mypy to return some meaningful results with a large codebase, and this requires writing a very large number of stubs. As a result, I see hundreds of lines of errors for very small files. To wade through all of this, I have been piping the results to head and gradually fixing various issues.

Every now and then, I have noticed that piping the results of the mypy output to head results in a broken pipe error.

Sometimes I see this error:

Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

At other times, I see this:

Traceback (most recent call last):
  File "/home/.../bin/mypy", line 6, in <module>
    main(__file__)
  File "/home/.../lib/python3.5/site-packages/mypy/main.py", line 53, in main
    f.write(m + '\n')
BrokenPipeError: [Errno 32] Broken pipe

Sometimes, I don't see any errors.

I can't provide a link to the project, due to copyright reasons, but you should be able to repeat this bug with any file which produces sufficiently long output if the results are fed to head, say with mypy some/file.py | head -n 10, etc.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions