Skip to content

Fix broken pipe when piping output from -E #1

@mkazin

Description

@mkazin

This command:
$ python statement_renamer/ -E Input/Hanscom\ Statements/pdf.pdf | egrep -i "hanscom|hfcu"

yields the following error:

Binary file (standard input) matches
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

Greater detail can be seen by piping to echo:
$ python statement_renamer/ -E Input/Hanscom\ Statements/pdf.pdf | echo | egrep -i "hanscom|hfcu"

Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "statement_renamer/__main__.py", line 3, in <module>
    main.main()
  File "statement_renamer/main.py", line 268, in main
    raise e
  File "statement_renamer/main.py", line 265, in main
    task.execute()
  File "statement_renamer/main.py", line 76, in execute
    self.determine_action_for_file(self.args.positional)
  File "statement_renamer/main.py", line 149, in determine_action_for_file
    print(contents)
BrokenPipeError: [Errno 32] Broken pipe

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions