Skip to content

BUG: Need graceful error message when passing a path object as depends_on #75

@hmgaudecker

Description

@hmgaudecker
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pytask.

  • (optional) I have confirmed this bug exists on the main branch of pytask.


To reproduce

Pass a pathlib.Path object as dependency to some task which points to a file that does not exist.

Problem description

The error message is cryptic even to the semi-initiated and it does not provide information on which file

Traceback (most recent call last):
  File "/home/xxx/miniconda3/envs/epp/lib/python3.8/site-packages/_pytask/resolve_dependencies.py", line 144, in _check_if_root_nodes_are_available
    dag.nodes[node]["node"].state()
  File "/home/xxx/miniconda3/envs/epp/lib/python3.8/site-packages/_pytask/nodes.py", line 180, in state
    raise NodeNotFoundError
_pytask.exceptions.NodeNotFoundError

During handling of the above exception, another exception occurred:

ValueError: A node must be defined in a child of 'paths'.

Expected Output

At a very minimum, line 180 of nodes.py should become

raise NodeNotFoundError(self.value)

but a more graceful error message pointing the user at what is causing this might be useful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions