New GitHub issue #110786 from FFY00:<br>
<hr>
<pre>
# Feature or enhancement
### Proposal:
I very often pipe the output of the `sysconfig` CLI to the [head](https://man.archlinux.org/man/head.1) utility from [coreutils](https://www.gnu.org/software/coreutils/), so that I can check only the "paths" section of the output. This results in a `BrokenPipeError` exception, as we keep trying to write after the pipe closes.
```
$ python -m sysconfig | head -n 14
Platform: "linux-x86_64"
Python version: "3.11"
Current installation scheme: "posix_prefix"
Paths:
data = "/usr"
include = "/usr/include/python3.11"
platinclude = "/usr/include/python3.11"
platlib = "/usr/lib/python3.11/site-packages"
platstdlib = "/usr/lib/python3.11"
purelib = "/usr/lib/python3.11/site-packages"
scripts = "/usr/bin"
stdlib = "/usr/lib/python3.11"
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/lib/python3.11/sysconfig.py", line 851, in <module>
_main()
File "/usr/lib/python3.11/sysconfig.py", line 847, in _main
_print_dict('Variables', get_config_vars())
File "/usr/lib/python3.11/sysconfig.py", line 833, in _print_dict
print(f'\t{key} = "{value}"')
BrokenPipeError: [Errno 32] Broken pipe
```
I'd be nice if we could suppress this error.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/110786">View on GitHub</a>
<p>Labels: type-feature</p>
<p>Assignee: </p>