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

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

Open
gregcaporaso opened this issue Oct 10, 2023 · 2 comments

Comments

@gregcaporaso
Copy link
Member

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.
@colinvwood
Copy link
Contributor

Four different types of payloads are accepted as indicated by this line:

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'].

Finding the proper parser is done by try/excepting each of them. We can't know that the FileNotFoundError is the most meaningful error.

@gregcaporaso
Copy link
Member Author

Thanks for looking into @colinvwood. Could we perform specific checks to narrow it down, either instead of the try/except or as a result of an Exception being raised?

@colinvwood colinvwood moved this to In Analysis in 2024.2 Nov 16, 2023
@colinvwood colinvwood moved this from In Analysis to Backlog in 2024.2 Dec 20, 2023
@colinvwood colinvwood removed this from 2024.2 Feb 12, 2024
@github-project-automation github-project-automation bot moved this to Backlog in 2024.5 Feb 12, 2024
@colinvwood colinvwood removed this from 2024.5 May 16, 2024
@github-project-automation github-project-automation bot moved this to Backlog in 2024.10 🎃 May 16, 2024
@ebolyen ebolyen removed this from 2024.10 🎃 Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants