← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1982426] [NEW] Python3.11: "glance-manage" crashes

 

Public bug reported:

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
$

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1982426

Title:
  Python3.11: "glance-manage" crashes

Status in Glance:
  New

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
  $

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1982426/+subscriptions



Follow ups