Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

do_* docstring can cause exn in global -h response [moved] #22

@trentm

Description

@trentm

This is Issue 22 moved from a Google Code project.
Added by 2010-01-27T19:19:17.000Z by 1024chic...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium

Original description

Given:

    def do_foo(self, subcmd, opts):
        """${cmd_usage}

        ${cmd_option_list}
        """
        [...]

"command help foo" works as expected, but "command -h" gives a traceback 
similar to the following:

Traceback (most recent call last):
  File &quot;.\maintain-nightlies.py&quot;, line 27, in <module>
    sys.exit(mn.main())
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 238, in main
    self.options, args = self.optparser.parse_args(argv[1:])
  File &quot;C:\Python26\lib\optparse.py&quot;, line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File &quot;C:\Python26\lib\optparse.py&quot;, line 1438, in _process_args
    self._process_short_opts(rargs, values)
  File &quot;C:\Python26\lib\optparse.py&quot;, line 1545, in _process_short_opts
    option.process(opt, value, values, self)
  File &quot;C:\Python26\lib\optparse.py&quot;, line 788, in process
    self.action, self.dest, opt, value, values, parser)
  File &quot;C:\Python26\lib\optparse.py&quot;, line 810, in take_action
    parser.print_help()
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 975, in print_help
    self.cmdln.onecmd([&quot;help&quot;])
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 1084, in _dispatch_cmd
    return handler(argv)
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 517, in do_help
    doc = self._help_preprocess(doc, cmdname)
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 598, in _help_preprocess
    help = preprocessor(help, cmdname)
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 739, in _help_preprocess_cmd_usage
    handler = self._get_cmd_handler(cmdname)
  File &quot;C:\Users\kjw\AppData\Roaming\Python\Python26\site-packages
\cmdln.py&quot;, line 865, in _get_cmd_handler
    handler = getattr(self, 'do_' + cmdname)
TypeError: cannot concatenate 'str' and 'NoneType' objects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions