pip: pip list |head raises BrokenPipeError
- Pip version: pip 9.0.1
- Python version: python 3.5
- Operating System: OS X 10.11.6 (15G1108)
Description:
pip list |tail
works like it should
pip list |head
… not so much
What I’ve run:
pip list |head
Output, for each package:
— Logging error — Traceback (most recent call last): File “/Users/…/anaconda/lib/python3.5/logging/init.py”, line 984, in emit self.flush() File “/Users/…/anaconda/lib/python3.5/logging/init.py”, line 964, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File “/Users/…/anaconda/bin/pip”, line 6, in <module> sys.exit(pip.main()) File “/Users/…/anaconda/lib/python3.5/site-packages/pip/init.py”, line 249, in main return command.main(cmd_args) File “/Users/…/anaconda/lib/python3.5/site-packages/pip/basecommand.py”, line 215, in main status = self.run(options, args) File “/Users/…/anaconda/lib/python3.5/site-packages/pip/commands/list.py”, line 164, in run self.output_package_listing(packages, options) File “/Users/…/anaconda/lib/python3.5/site-packages/pip/commands/list.py”, line 258, in output_package_listing logger.info(self.output_legacy(dist)) Message: ‘xlwt (1.1.2)’ Arguments: () Exception ignored in: <_io.TextIOWrapper name=‘<stdout>’ mode=‘w’ encoding=‘UTF-8’> BrokenPipeError: [Errno 32] Broken pipe
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 16 (10 by maintainers)
Commits related to this issue
- fix #4170: log ignores broken-pipes in STDERR when `pip | head` — committed to ankostis/pip by ankostis 6 years ago
- fix: patch also stdout.flush() from colorama for #4170 bc on Windows it breaks with OSError(errno.EINVAL) after pip has broken. + Fix a bit the TC according to PY2 behavior. — committed to ankostis/pip by ankostis 6 years ago
- [WIP] enh: test-case for #4170 fix based omn `pip | head` — committed to ankostis/pip by ankostis 6 years ago
- fix #4170: log ignores broken-pipes in STDERR when `pip | head` — committed to ankostis/pip by ankostis 6 years ago
- fix: patch also stdout.flush() from colorama for #4170 bc on Windows it breaks with OSError(errno.EINVAL) after pip has broken. + Fix a bit the TC according to PY2 behavior. — committed to ankostis/pip by ankostis 6 years ago
From the link @piotr-dobrogost posted, here’s a workaround:
This “bug” is essentially how unix pipes work. pip can’t do anything about this.