Python print and wc with invalid argument leads to OSError

被刻印的时光 ゝ 提交于 2021-02-18 16:56:12

问题


I've come across some (to me) weird behaviour when piping the output of a Python script into wc with invalid arguments.

λ python test.py
Hello!
λ python test.py | wc -li
wc: unknown option -- i
Try 'wc --help' for more information.
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1252'>
OSError: [Errno 22] Invalid argument

What is happening here?

My configuration is

  • Windows 10
  • Cmder
  • msysgit 2.5.1.windows.1

来源:https://stackoverflow.com/questions/32555219/python-print-and-wc-with-invalid-argument-leads-to-oserror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!