Opened 12 years ago

Closed 12 years ago

#2120 defect closed duplicate (duplicate)

usage.Options breaks with short subcommand names longer than 1 char

Reported by: msalib Owned by:
Priority: low Milestone:
Component: core Keywords:
Cc: Branch:


Generating help text for twisted.python.usage.Options when using subcommands that have a short name longer than one character triggers a TypeError. The TypeError is rather opaque and doesn't explain that short names are limited to one character. Even stranger, short names longer than one character work for parameters (at least they don't produce a TypeError).

I suggest the following:

  • the code would produce an error that explains which subcommand is causing problems and that short names are limited to a character.
  • the code for checking subcommand short names should do the same thing as the code that checks parameter short names (which just ignores improper short names)
  • the options howto should get a line added that indicates that short names are limited to a single character.

To test, write the following bit of code into a file, then run it with --help.

from twisted.python.usage import Options class MySubOptions(Options):


class Options(Options):

subCommands = [

["mine", "m", MySubOptions, "it is mine!"]]

config = Options() config.parseOptions()

Change History (2)

comment:1 Changed 12 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

Duplicate of #2121

comment:2 Changed 8 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.