-
Notifications
You must be signed in to change notification settings - Fork 49
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
Commands fail on Python 3.11: argparse.ArgumentError: argument command: conflicting subparser #361
Comments
As a quick and ugly workaround the currently undocumented holland/core/command/command.py#L86-95
This works as a short-term solution but it's probably not wise to rely on undocumented library APIs. |
Just a suggestion here if I may, but it is possible that a solution that avoids undocumented features could be found in |
Do I get this correctly: this issue completely breaks the application, and there hasn't been a fix in over half a year. Is holland no longer maintained? |
I was the primary maintainer when I worked at Rackspace. But it looks like no one there has picked this up since I left. Unfortunately, I don't have time to spend on this outside of work. I'm happy to review and merge code if someone will submit a patch. |
@soulen3 what are your thoughts about trying the I didn't look at every distro, but it does look like eg Ubuntu 24.04 will release with python 3.11 and this issue may start to affect more users. |
It would be great if you oculd submit a patch @mikegriffin. It's already affecting downstream, e.g. the package is completely broken on Arch Linux. It would be horrible if it was broken on an LTS Ubuntu build. |
It's not great, but I'll merge it if that's the only thing people have time to do. |
I can confirm that the quick and ugly workaround appears to solve the problem in this bug in Ubuntu Noble 24.04:
I filed an unrelated bug that gives a warning but does not break the backup. I propose that we merge the change and create a new bug to migrate from |
FWIW, I should mention I've been running holland with this fix ever since I posted it last year and haven't noticed any issues so far (on a few Arch systems), but I also haven't tested it extensively beyond my normal use of the application. I definitely agree a proper re-write of the subparser handling or possibly a switch to click would probably be a lot better, but I haven't had the time to dive into this myself. |
Every command currently fails when running holland using Python 3.11, e.g.
This is because of a breaking change in Python 3.11's argparse module with regards to adding duplicate subparsers with the same name:
From a quick glance at the code it appears that holland command objects are instantiated twice (the process during which the subparsers are created and added); once during initialization of the program and another time when the command is actually run. The second instantiation causes this error due to the subparser already being present in the global
SUBPARSER
.The text was updated successfully, but these errors were encountered: