Skip to content

improve error message from qiime tools replay-proveance on invalid input file path #321

Description

@gregcaporaso

I got the following error message after passing a invalid file path (my input file didn't exist). This should produce a more concise error message, just focused around the FileNotFoundError.

$  qiime tools replay-provenance --in-fp cm99979-obs-features.qza --out-fp replay-reads.bash
Traceback (most recent call last):
  File "/masked-path/qiime2-shotgun-2023.9/bin/qiime", line 11, in <module>
    sys.exit(qiime())
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/q2cli/builtin/tools.py", line 1018, in provenance_replay
    replay_provenance(
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/qiime2/core/archive/provenance_lib/replay.py", line 286, in replay_provenance
    dag = ProvDAG(
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/qiime2/core/archive/provenance_lib/parse.py", line 85, in __init__
    parser_results = parse_provenance(cfg, artifact_data)
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/qiime2/core/archive/provenance_lib/parse.py", line 541, in parse_provenance
    parser = select_parser(payload)
  File "/masked-path/qiime2-shotgun-2023.9/lib/python3.8/site-packages/qiime2/core/archive/provenance_lib/parse.py", line 594, in select_parser
    raise UnparseableDataError(err_msg)
qiime2.core.archive.provenance_lib.parse.UnparseableDataError: Input data cm99979-obs-features.qza is not supported.
Parsers are available for the following data types: ['a path to a file (a string) or a file-like object', 'filepath to a directory containing .qza/.qzv archives', 'ProvDAG', 'None'].
The following errors were caught while trying to identify a parser that can_handle this input data:
<class 'FileNotFoundError'>[Errno 2] No such file or directory: 'cm99979-obs-features.qza'
<class 'ValueError'> in DirectoryParser: cm99979-obs-features.qza is not a valid directory.
<class 'TypeError'> in ProvDAGParser: cm99979-obs-features.qza is not a ProvDAG.
<class 'TypeError'> in EmptyParser: cm99979-obs-features.qza is not None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions