qmk / qmk_cli

A program to help users work with QMK
MIT License
142 stars 35 forks source link

[Bug] QMK CLI crashes with "conflicting subparser" error #150

Closed nickpascucci closed 1 year ago

nickpascucci commented 1 year ago

Describe the Bug

All of the QMK CLI commands fail with an error from MILC. I'm using the latest version from Homebrew (1.1.2_1). It appears to be related to argparse changes in Python 3.11; see, for example, https://github.com/Azure/azure-cli/issues/23015.

Additional Context?

~/qmk_firmware [nickpascucci●] » qmk compile
Traceback (most recent call last):
  File "/usr/local/bin/qmk", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/Cellar/qmk/1.1.2_1/libexec/lib/python3.11/site-packages/qmk_cli/script_qmk.py", line 76, in main
    import qmk.cli  # noqa
    ^^^^^^^^^^^^^^
  File "/Users/nick/qmk_firmware/lib/python/qmk/cli/__init__.py", line 223, in <module>
    __import__(subcommand)
  File "/Users/nick/qmk_firmware/lib/python/qmk/cli/console.py", line 262, in <module>
    @cli.subcommand('Acquire debugging information from usb hid devices.', hidden=False if cli.config.user.developer else True)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/qmk/1.1.2_1/libexec/lib/python3.11/site-packages/milc/milc.py", line 623, in subcommand_function
    return self.add_subcommand(handler, description, hidden=hidden, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/qmk/1.1.2_1/libexec/lib/python3.11/site-packages/milc/milc.py", line 604, in add_subcommand
    self.subcommands[name] = SubparserWrapper(self, name, self._subparsers.add_parser(name, **kwargs))
                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1192, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument {config,clone,console,env,setup,c2json,chibios-confmigrate,clean,compile}: conflicting subparser: console
fauxpark commented 1 year ago

Your repo is out of date. qmk console has been moved here from qmk_firmware.

nickpascucci commented 1 year ago

Yes, you're totally right. I'm working from an old fork; it didn't occur to me that the CLI would try to source a module from the local tree. Thanks!