Issue 13113: Wrong error message on class instance, when giving too little positional arguments (original) (raw)
I've this class:
class Path: """Class that handles path related configurations"""
def __init__(self,
target_host,
remote_user,
remote_prefix,
initial_manifest=False,
base_dir=None,
debug=False):
That is falsely instantiated from a different class with these arguments:
self.path = cdist.path.Path(self.target_host,
initial_manifest=initial_manifest,
base_dir=home,
debug=debug)
Which results in the following traceback:
[13:40] kr:cdist% ./bin/cdist config -d localhost Traceback (most recent call last): File "./bin/cdist", line 119, in commandline() File "./bin/cdist", line 102, in commandline args.func(args) File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/config.py", line 296, in config c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/config.py", line 52, in init debug=debug) TypeError: init() takes at least 4 arguments (5 given)
Problem:
- there are 5 arguments, so an error message indicating there are at least 4 needed is not helpful
Proposal (pseudocode):
Change to "Only %d of %d required positional arguments given" required_positional, giving_positional