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

Say "Directory not found" instead of "IndexError" when source directory does not exist #1967

Closed
3 tasks done
pawamoy opened this issue Jan 31, 2020 · 2 comments
Closed
3 tasks done
Labels
area/error-handling Bad error messages/insufficient error handling

Comments

@pawamoy
Copy link

pawamoy commented Jan 31, 2020

  • 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: Windows 10

  • Poetry version: 1.0.2

Can't use Gist:

[tool.poetry]
name = "test-locust"
version = "0.1.0"
description = "auhgzdihgeziuhgziuhgzefiuhezf"
authors = ["Timothee Mazzucotelli <my@email.com>"]
readme = "README.md"
repository = "redacted"
homepage = "redacted"
keywords = []
packages = [ { include = "test_locust", from = "src" } ]
include = [
    "README.md",
    "pyproject.toml"
]
λ poetry install -v
Creating virtualenv test-locust-y9rNsmSK-py3.8 in C:\Users\REDACTED\.venvs
Using virtualenv: C:\Users\REDACTED\.venvs\test-locust-y9rNsmSK-py3.8
Installing dependencies from lock file


Package operations: 9 installs, 0 updates, 0 removals

  - Installing appdirs (1.4.3)
  - Installing attrs (19.3.0)
  - Installing click (7.0)
  - Installing pathspec (0.7.0)
  - Installing regex (2020.1.8)
  - Installing toml (0.10.0)
  - Installing typed-ast (1.4.1)
  - Installing black (19.10b0)
  - Installing isort (4.3.21)

[IndexError]
list index out of range

Traceback (most recent call last):
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\clikit\console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\clikit\api\command\command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\clikit\api\command\command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\cleo\commands\command.py", line 92, in wrap_handle
    return self.handle()
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\poetry\console\commands\install.py", line 72, in handle
    builder = EditableBuilder(self.poetry, self._env, NullIO())
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\poetry\masonry\builders\builder.py", line 64, in __init__
    self._module = Module(
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\poetry\masonry\utils\module.py", line 68, in __init__
    PackageInclude(
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\poetry\masonry\utils\package_include.py", line 15, in __init__
    self.check_elements()
  File "C:\Users\REDACTED\.condax\poetry\lib\site-packages\poetry\masonry\utils\package_include.py", line 37, in check_elements
    root = self._elements[0]

Issue

The exception occurs because I don't have an src/test_locust folder as specified in the config.
What I am asking is simply that poetry shows a useful message saying it couldn't find the src/test_locust directory, just like when it says

[ValueError]
test_locust is not a package.

or

[FileNotFoundError]
[Errno 2] No such file or directory: 'C:\\Users\\REDACTED\\data\\dev\\wref\\test-locust\\README.md'

Thanks 🙂 !

@pawamoy pawamoy added the kind/bug Something isn't working as expected label Jan 31, 2020
@finswimmer finswimmer added area/error-handling Bad error messages/insufficient error handling and removed kind/bug Something isn't working as expected labels Jan 31, 2020
@pawamoy
Copy link
Author

pawamoy commented Apr 11, 2020

Fixed by 511d753 in #2265

@pawamoy pawamoy closed this as completed Apr 11, 2020
Copy link

github-actions bot commented Mar 3, 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 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/error-handling Bad error messages/insufficient error handling
Projects
None yet
Development

No branches or pull requests

2 participants