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

Cache clear fails without waiting for input #5633

Closed
2 of 3 tasks
provinzkraut opened this issue May 18, 2022 · 4 comments · Fixed by #5647
Closed
2 of 3 tasks

Cache clear fails without waiting for input #5633

provinzkraut opened this issue May 18, 2022 · 4 comments · Fixed by #5647
Labels
area/cli Related to the command line kind/bug Something isn't working as expected
Milestone

Comments

@provinzkraut
Copy link

  • 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: Ubuntu 21.10
  • Poetry version: 1.2.0b1
  • Link of a Gist with the contents of your pyproject.toml file: None needed

Issue

When running poetry cache clear <cache name> --all fails with the following error:

Delete 2812 entries? (yes/no) [no] 
AttributeError

'NoneType' object has no attribute 'readline'

at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/io/inputs/input.py:77 in read_line
     73│         """
     74│         if not self._interactive:
     75│             return default
     76│ 
  →  77│         return self._stream.readline(length)
     78│ 
     79│     def close(self) -> None:
     80│         """
     81│         Closes the input.

It does display the Delete 2812 entries? (yes/no) [no] line, however it does not wait for an input and defaults to no.

@provinzkraut provinzkraut added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels May 18, 2022
@Secrus Secrus added area/cli Related to the command line and removed status/triage This issue needs to be triaged labels May 18, 2022
@Secrus
Copy link
Member

Secrus commented May 18, 2022

Confirmed. It does the same thing on my machine and master branch version from May 17th

@volker48
Copy link

volker48 commented Jun 3, 2022

Hitting the same issue. Here is the stack trace with verbose logging enabled

Delete 430 entries? (yes/no) [no]
  Stack trace:

  13  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/application.py:330 in run
       328│
       329│             try:
     → 330│                 exit_code = self._run(io)
       331│             except Exception as e:
       332│                 if not self._catch_exceptions:

  12  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/poetry/console/application.py:174 in _run
       172│         self._load_plugins(io)
       173│
     → 174│         return super()._run(io)
       175│
       176│     def _configure_io(self, io: IO) -> None:

  11  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/application.py:425 in _run
       423│                 io.set_input(ArgvInput(argv))
       424│
     → 425│         exit_code = self._run_command(command, io)
       426│         self._running_command = None
       427│

  10  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/application.py:467 in _run_command
       465│
       466│         if error is not None:
     → 467│             raise error
       468│
       469│         return event.exit_code

   9  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/application.py:451 in _run_command
       449│
       450│             if event.command_should_run():
     → 451│                 exit_code = command.run(io)
       452│             else:
       453│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   8  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/commands/base_command.py:118 in run
       116│         io.input.validate()
       117│
     → 118│         status_code = self.execute(io)
       119│
       120│         if status_code is None:

   7  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/commands/command.py:85 in execute
        83│
        84│         try:
     →  85│             return self.handle()
        86│         except KeyboardInterrupt:
        87│             return 1

   6  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/poetry/console/commands/cache/clear.py:59 in handle
        57│             )
        58│
     →  59│             delete = self.confirm(f"Delete {entries_count} entries?")
        60│             if not delete:
        61│                 return 0

   5  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/commands/command.py:143 in confirm
       141│         )
       142│
     → 143│         return question.ask(self._io)
       144│
       145│     def ask(

   4  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/ui/question.py:75 in ask
        73│
        74│         if not self._validator:
     →  75│             return self._do_ask(io)
        76│
        77│         def interviewer():

   3  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/ui/question.py:101 in _do_ask
        99│
       100│             if not ret:
     → 101│                 ret = self._read_from_input(io)
       102│         else:
       103│             ret = self._autocomplete(io)

   2  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/ui/question.py:260 in _read_from_input
       258│         Read user input.
       259│         """
     → 260│         ret = io.read_line(4096)
       261│
       262│         if not ret:

   1  ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/io/io.py:42 in read_line
        40│         Reads a line from the input stream.
        41│         """
     →  42│         return self._input.read_line(length=length, default=default)
        43│
        44│     def write_line(

  AttributeError

  'NoneType' object has no attribute 'readline'

  at ~/.asdf/installs/python/3.10.4/lib/python3.10/site-packages/cleo/io/inputs/input.py:77 in read_line
       73│         """
       74│         if not self._interactive:
       75│             return default
       76│
    →  77│         return self._stream.readline(length)
       78│
       79│     def close(self) -> None:
       80│         """
       81│         Closes the input.```

@neersighted
Copy link
Member

This should be fixed in master thanks to a Cleo version bump, and indeed no longer reproduces for me. Please comment here if it's not resolved for you in the latest master.

Copy link

github-actions bot commented Mar 2, 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 2, 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