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

Default argument parsing isn't working correctly #23

Open
caufieldjh opened this issue Nov 16, 2022 · 0 comments
Open

Default argument parsing isn't working correctly #23

caufieldjh opened this issue Nov 16, 2022 · 0 comments

Comments

@caufieldjh
Copy link
Contributor

Running universalizer like this works as expected:

$ universalizer run local_graph/ --update_categories --contexts obo

But omit the contexts argument and it tries to use the default contexts, failing in the process:

$ universalizer run local_graph/ --update_categories
Input path: local_graph/
Will update categories.
Found these graph files:['local_graph/merged-kg_nodes.tsv', 'local_graph/merged-kg_edges.tsv']
Traceback (most recent call last):
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/bin/universalizer", line 5, in <module>
    cli()
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/harry/universalizer/universalizer/cli.py", line 74, in run
    if clean_and_normalize_graph(
  File "/home/harry/universalizer/universalizer/norm.py", line 85, in clean_and_normalize_graph
    remap_these_nodes = make_id_maps(nodepath, os.path.dirname(nodepath), contexts)
  File "/home/harry/universalizer/universalizer/norm.py", line 192, in make_id_maps
    curie_contexts = load_multi_context(contexts)
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/prefixmaps/io/parser.py", line 37, in load_multi_context
    ctxt.combine(load_context(n, refresh=refresh))
  File "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/prefixmaps/io/parser.py", line 54, in load_context
    with open(data_path / f"{name}.csv", encoding="utf-8") as file:
FileNotFoundError: [Errno 2] No such file or directory: "/home/harry/.cache/pypoetry/virtualenvs/universalizer-fyE8bHoK-py3.9/lib/python3.9/site-packages/prefixmaps/data/['obo',.csv"

The context names appear to be parsed incorrectly.

It's also not possible to pass multiple space-delimited contexts:

$ universalizer run local_graph/ --update_categories --contexts obo bioregistry.upper
Usage: universalizer run [OPTIONS] INPUT_PATH
Try 'universalizer run --help' for help.

Error: Got unexpected extra argument (bioregistry.upper)

This works if they're placed in quotes, which is fine, but that should be in the documentation.

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

1 participant