Skip to content

planemo gives confusing message on unknown command #1565

@cthoyt

Description

@cthoyt

I ran uvx planemo list (list is not actually a command) and got the following error message:

      Built glob2==0.7
█░░░░░░░░░░░░░░░░░░░ [9/93] zipstream-new==1.1.8                                                                                                                                       warning: The module `galaxy` is provided by more than one package, which causes an install race condition and can result in a broken module. Consider removing your dependency on either `galaxy-util` (v25.0.2) or `galaxy-tool-util` (v25.0.2).
████████░░░░░░░░░░░░ [39/93] tabulate==0.9.0                                                                                                                                           warning: The module `galaxy` is provided by more than one package, which causes an install race condition and can result in a broken module. Consider removing your dependency on either `galaxy-tool-util-models` (v25.0.2) or `galaxy-tool-util` (v25.0.2).
Installed 93 packages in 179ms
/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/glob2/fnmatch.py:141: SyntaxWarning: invalid escape sequence '\Z'
  return '(?ms)' + res + '\Z'
Traceback (most recent call last):
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/planemo/cli.py", line 75, in name_to_command
    mod = __import__(mod_name, None, None, ["cli"])
ModuleNotFoundError: No module named 'planemo.commands.cmd_list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/bin/planemo", line 12, in <module>
    sys.exit(planemo())
             ~~~~~~~^^
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/click/core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/click/core.py", line 1363, in main
    rv = self.invoke(ctx)
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/click/core.py", line 1824, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
                          ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/click/core.py", line 1871, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/planemo/cli.py", line 88, in get_command
    return name_to_command(name)
  File "/Users/cthoyt/.cache/uv/archive-v0/Zk12WzPFXCeRzQp5yGFD7/lib/python3.13/site-packages/planemo/cli.py", line 77, in name_to_command
    raise Exception(f"Problem loading command {name}, exception {e}")
Exception: Problem loading command list, exception No module named 'planemo.commands.cmd_list'

I guess it's doing some sketchy dynamic importing. Instead of writing the message like this, it should catch the ModuleNotFoundError and instead give a simpler message that says that there's no plugin for that command

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions