Launchpad

Python3.11: "glance-manage" crashes

This bug affects 1 person

Affects Status Importance Assigned to Milestone
Glance

Fix Released

Undecided

Unassigned

Bug Description

Removing a lot of the output since Launchpad is not going to format it properly anyway:

$ glance-manage -h
...
argparse. ArgumentError: argument command: conflicting subparser: db_version

This happens because the argparse module became stricter in Python3.11 and prevents us from adding the same subparser twice:

$ cat parser.py
import argparse

parser = argparse. ArgumentParser( )
subparsers = parser. add_subparsers( title=' Commands' )
subparsers. add_parser( 'foo')
subparsers. add_parser( 'foo')
subparsers. add_parser( 'bar')
parser.parse_args()

$ python3.10 parser.py
$ python3.11 parser.py
Traceback (most recent call last):
  File "/tmp/parser.py", line 6, in <module>
    subparsers. add_parser( 'foo')
  File "/usr/lib/ python3. 11/argparse. py", line 1197, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse. ArgumentError: argument {foo}: conflicting subparser: foo
$

Read the original on bugs.launchpad.net ↗