Skip to content

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

Closed
@pawamoy

Description

  • 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 🙂 !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/error-handlingBad error messages/insufficient error handling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions