Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry displays very verbose "broken pipe traceback" if output is not fully read #3602

Closed
3 tasks done
maxnoe opened this issue Jan 23, 2021 · 5 comments · Fixed by python-poetry/cleo#165
Closed
3 tasks done
Labels
area/cli Related to the command line kind/bug Something isn't working as expected

Comments

@maxnoe
Copy link

maxnoe commented Jan 23, 2021

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Manjaro

  • Poetry version: 1.1.4

Issue

When not reading all output of poetry, e.g. like this:

poetry -v | head -n 1

poetry displays a very verbose broken pipe error:

Traceback (most recent call last):
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/maxnoe/.local/lib/python3.9/site-packages/poetry/console/commands/show.py", line 256, in handle
    self.line(line)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/cleo/commands/command.py", line 233, in line
    self._io.write_line(styled, verbosity)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/cleo/io/io_mixin.py", line 65, in write_line
    super(IOMixin, self).write_line(string, flags)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/io/io.py", line 66, in write_line
    self._output.write_line(string, flags=flags)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/io/output.py", line 69, in write_line
    self.write(string, flags=flags, new_line=True)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/io/output.py", line 61, in write
    self._stream.write(to_str(formatted))
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/io/output_stream/stream_output_stream.py", line 25, in write
    self._stream.flush()
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/maxnoe/.local/bin/poetry", line 8, in <module>
    sys.exit(main())
  File "/home/maxnoe/.local/lib/python3.9/site-packages/poetry/console/__init__.py", line 5, in main
    return Application().run()
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/console_application.py", line 142, in run
    trace.render(io, simple=isinstance(e, CliKitException))
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/ui/components/exception_trace.py", line 232, in render
    return self._render_exception(io, self._exception)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/ui/components/exception_trace.py", line 259, in _render_exception
    self._render_line(
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/ui/components/exception_trace.py", line 400, in _render_line
    io.write_line("")
  File "/home/maxnoe/.local/lib/python3.9/site-packages/cleo/io/io_mixin.py", line 65, in write_line
    super(IOMixin, self).write_line(string, flags)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/io/io.py", line 66, in write_line
    self._output.write_line(string, flags=flags)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/io/output.py", line 69, in write_line
    self.write(string, flags=flags, new_line=True)
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/api/io/output.py", line 61, in write
    self._stream.write(to_str(formatted))
  File "/home/maxnoe/.local/lib/python3.9/site-packages/clikit/io/output_stream/stream_output_stream.py", line 25, in write
    self._stream.flush()
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
@maxnoe maxnoe added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 23, 2021
@pierresouchay
Copy link

Yes, same issue here

@pierresouchay
Copy link

We also have a reallty weird behaviour regarding stdout:

$ poetry show|grep toml
toml           0.10.2 Python Library for Tom's Obvious, Minimal Language
tomlkit        0.7.1  Style preserving TOML library

But:

poetry show|grep -q toml
Traceback (most recent call last):
  File "<redacted>/lib/python3.9/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "<redacted>/lib/python3.9/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "<redacted>/lib/python3.9/site-packages/poetry/console/commands/show.py", line 256, in handle
    self.line(line)
  File "<redacted>/lib/python3.9/site-packages/cleo/commands/command.py", line 233, in line
    self._io.write_line(styled, verbosity)
  File "<redacted>/lib/python3.9/site-packages/cleo/io/io_mixin.py", line 65, in write_line
    super(IOMixin, self).write_line(string, flags)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/io/io.py", line 66, in write_line
    self._output.write_line(string, flags=flags)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/io/output.py", line 69, in write_line
    self.write(string, flags=flags, new_line=True)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/io/output.py", line 61, in write
    self._stream.write(to_str(formatted))
  File "<redacted>/lib/python3.9/site-packages/clikit/io/output_stream/stream_output_stream.py", line 25, in write
    self._stream.flush()
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<redacted>/bin/poetry", line 8, in <module>
    sys.exit(main())
  File "<redacted>/lib/python3.9/site-packages/poetry/console/__init__.py", line 5, in main
    return Application().run()
  File "<redacted>/lib/python3.9/site-packages/clikit/console_application.py", line 142, in run
    trace.render(io, simple=isinstance(e, CliKitException))
  File "<redacted>/lib/python3.9/site-packages/clikit/ui/components/exception_trace.py", line 232, in render
    return self._render_exception(io, self._exception)
  File "<redacted>/lib/python3.9/site-packages/clikit/ui/components/exception_trace.py", line 259, in _render_exception
    self._render_line(
  File "<redacted>/lib/python3.9/site-packages/clikit/ui/components/exception_trace.py", line 400, in _render_line
    io.write_line("")
  File "<redacted>/lib/python3.9/site-packages/cleo/io/io_mixin.py", line 65, in write_line
    super(IOMixin, self).write_line(string, flags)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/io/io.py", line 66, in write_line
    self._output.write_line(string, flags=flags)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/io/output.py", line 69, in write_line
    self.write(string, flags=flags, new_line=True)
  File "<redacted>/lib/python3.9/site-packages/clikit/api/io/output.py", line 61, in write
    self._stream.write(to_str(formatted))
  File "<redacted>/lib/python3.9/site-packages/clikit/io/output_stream/stream_output_stream.py", line 25, in write
    self._stream.flush()
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

@asandeep
Copy link

+1

@abn abn added the area/cli Related to the command line label Apr 26, 2022
@abn
Copy link
Member

abn commented Apr 26, 2022

I reckon this is more an issue in cleo/clikit rather than Poetry as the commands and IO are managed there. However if folks have workaround/mitigation , PRs welcome.

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/cli Related to the command line kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants