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

AttributeError on poetry export #3309

Closed
finswimmer opened this issue Oct 30, 2020 · 1 comment
Closed

AttributeError on poetry export #3309

finswimmer opened this issue Oct 30, 2020 · 1 comment
Labels
kind/bug Something isn't working as expected

Comments

@finswimmer
Copy link
Member

finswimmer commented Oct 30, 2020

I stumbled on it, while checking type hints for poetry. In the case poetry export is called with -v and no lock file exists, poetry raises an AttributeError:

$ poetry export -f requirements.txt -vvv 
The lock file does not exist. Locking.

  Stack trace:

  8  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/console_application.py:131 in run
      129│             parsed_args = resolved_command.args
      130│ 
    → 131│             status_code = command.handle(parsed_args, io)
      132│         except KeyboardInterrupt:
      133│             status_code = 1

  7  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:120 in handle
      118│     def handle(self, args, io):  # type: (Args, IO) -> int
      119│         try:
    → 120│             status_code = self._do_handle(args, io)
      121│         except KeyboardInterrupt:
      122│             if io.is_debug():

  6  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:171 in _do_handle
      169│         handler_method = self._config.handler_method
      170│ 
    → 171│         return getattr(handler, handler_method)(args, io, self)
      172│ 
      173│     def __repr__(self):  # type: () -> str

  5  ~/.poetry/lib/poetry/_vendor/py3.8/cleo/commands/command.py:92 in wrap_handle
       90│         self._command = command
       91│ 
    →  92│         return self.handle()
       93│ 
       94│     def handle(self):  # type: () -> Optional[int]

  4  ~/.poetry/lib/poetry/console/commands/export.py:53 in handle
      51│                 options.append(("-v", None))
      52│ 
    → 53│             self.call("lock", options)
      54│ 
      55│         if not locker.is_fresh():

  3  ~/.poetry/lib/poetry/_vendor/py3.8/cleo/commands/command.py:107 in call
      105│             args = ""
      106│ 
    → 107│         args = StringArgs(args)
      108│         command = self.application.get_command(name)
      109│ 

  2  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/args/string_args.py:20 in __init__
      18│         parser = TokenParser()
      19│ 
    → 20│         self._tokens = parser.parse(string)
      21│         self._option_tokens = list(
      22│             itertools.takewhile(lambda arg: arg != "--", self.tokens)

  1  ~/.poetry/lib/poetry/_vendor/py3.8/clikit/args/token_parser.py:27 in parse
       25│             self._next_ = string[1]
       26│ 
    →  27│         tokens = self._parse()
       28│ 
       29│         return tokens

  AttributeError

  'tuple' object has no attribute 'isspace'

  at ~/.poetry/lib/poetry/_vendor/py3.8/clikit/args/token_parser.py:35 in _parse
       31│     def _parse(self):  # type: () -> List[str]
       32│         tokens = []
       33│ 
       34│         while self._is_valid():
    →  35│             if self._current.isspace():
       36│                 # Skip spaces
       37│                 self._next()
       38│ 
       39│                 continue

The reason for this is, that -vvv is added as a tuple (options.append(("-vvv", None))) instead of a single string.

Fix is coming soon ....

@finswimmer finswimmer added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 30, 2020
abn pushed a commit that referenced this issue Nov 19, 2020
When a lock file does not exist when handling export command, option 
propagation for lock sub-command was incorrect. This change corrects 
this issue.

Resolves: #3309
@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
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
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants