-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Closed
Copy link
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged
Description
- Poetry version: 1.3.2
- Python version: 3.11.2
- OS version and name: Ubuntu 22.10
- pyproject.toml: not created, crash
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Package to add or search for (leave blank to skip): now we crash
Invalid package definition.
Package to add or search for (leave blank to skip): maybe now
Adding maybe now
Add a package (leave blank to skip): how about this
Stack trace:
12 .venv/lib/python3.11/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
11 .venv/lib/python3.11/site-packages/poetry/console/application.py:190 in _run
188│ self._load_plugins(io)
189│
→ 190│ exit_code: int = super()._run(io)
191│ return exit_code
192│
10 .venv/lib/python3.11/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
9 .venv/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
8 .venv/lib/python3.11/site-packages/cleo/application.py:457 in _run_command
455│
456│ if command_event.command_should_run():
→ 457│ exit_code = command.run(io)
458│ else:
459│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
7 .venv/lib/python3.11/site-packages/cleo/commands/base_command.py:119 in run
117│ io.input.validate()
118│
→ 119│ status_code = self.execute(io)
120│
121│ if status_code is None:
6 .venv/lib/python3.11/site-packages/cleo/commands/command.py:62 in execute
60│
61│ try:
→ 62│ return self.handle()
63│ except KeyboardInterrupt:
64│ return 1
5 .venv/lib/python3.11/site-packages/poetry/console/commands/init.py:198 in handle
196│ help_displayed = True
197│ requirements.update(
→ 198│ self._format_requirements(self._determine_requirements([]))
199│ )
200│ if self.io.is_interactive():
4 .venv/lib/python3.11/site-packages/poetry/console/commands/init.py:287 in _determine_requirements
285│ package = self.ask(question)
286│ while package:
→ 287│ constraint = self._parse_requirements([package])[0]
288│ if (
289│ "git" in constraint
3 .venv/lib/python3.11/site-packages/poetry/console/commands/init.py:426 in _parse_requirements
424│ cwd = Path.cwd()
425│
→ 426│ return [
427│ parse_dependency_specification(
428│ requirement=requirement,
2 .venv/lib/python3.11/site-packages/poetry/console/commands/init.py:427 in <listcomp>
425│
426│ return [
→ 427│ parse_dependency_specification(
428│ requirement=requirement,
429│ env=self.env if isinstance(self, EnvCommand) else None,
1 .venv/lib/python3.11/site-packages/poetry/utils/dependency_specification.py:218 in parse_dependency_specification
216│ _parse_dependency_specification_url(requirement, env=env)
217│ or _parse_dependency_specification_path(requirement, cwd=cwd)
→ 218│ or _parse_dependency_specification_simple(requirement)
219│ )
220│
ValueError
too many values to unpack (expected 2)
at .venv/lib/python3.11/site-packages/poetry/utils/dependency_specification.py:117 in _parse_dependency_specification_simple
113│
114│ require: DependencySpec = {}
115│
116│ if " " in pair:
→ 117│ name, version = pair.split(" ", 2)
118│ extras_m = re.search(r"\[([\w\d,-_]+)\]$", name)
119│ if extras_m:
120│ extras = [e.strip() for e in extras_m.group(1).split(",")]
121│ name, _ = name.split("[")
Issue
Putting spaces in "Package to add or search for (leave blank to skip): prompt gives different results each time, the third time in a row it crashes.
Using a valid package on the first prompt causes a crash when spaces are used in response to the prompt the second time. I.E. respond with e.g. Django for the first package name, then now we crash for the second package name.
Unfortunately, Poetry just exits and does not write any of your prior responses anywhere so you're starting over next time.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged