New submission from siccegge:

Hi!

Both the 3.4 version and the current version of python documentation wrt the 
argparse module imply convert_arg_line_to_args replacements needs to accept two 
arguments while it acutally only works with one. (Not completely sure about 
details but documentation really could be clearer!)

https://docs.python.org/3.4/library/argparse.html#argparse.ArgumentParser.convert_arg_line_to_args

Example from documentation

    def convert_arg_line_to_args(self, arg_line):
        return arg_line.split()

If codeparser = argparse.ArgumentParser actually does

    def convert_arg_line_to_args(self, arg_line):
        return arg_line.split()
    parser = argparse.ArgumentParser()    
    parser.convert_arg_line_to_args = convert_arg_line_to_args

The code fails

  File "/usr/lib/python3.5/argparse.py", line 1735, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.5/argparse.py", line 1767, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.5/argparse.py", line 1779, in _parse_known_args
    arg_strings = self._read_args_from_files(arg_strings)
  File "/usr/lib/python3.5/argparse.py", line 2037, in _read_args_from_files
    for arg in self.convert_arg_line_to_args(arg_line):
  TypeError: convert_arg_line_to_args() missing 1 required positional argument: 
'arg_line'

----------
assignee: docs@python
components: Documentation
messages: 278771
nosy: docs@python, siccegge
priority: normal
severity: normal
status: open
title: argparse: convert_arg_line_to_args does not actually expect self argument
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28455>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to