Closed
Description
Describe the bug
In some test code of my CodaLab CLI python wrapper, I would get the following exception
...
env/lib/python3.7/argparse.py:1744: in parse_args
args, argv = self.parse_known_args(args, namespace)
env/lib/python3.7/argparse.py:1776: in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
env/lib/python3.7/argparse.py:1963: in _parse_known_args
positionals_end_index = consume_positionals(start_index)
env/lib/python3.7/argparse.py:1941: in consume_positionals
take_action(action, args)
env/lib/python3.7/argparse.py:1850: in take_action
action(self, namespace, argument_values, option_string)
env/lib/python3.7/argparse.py:1146: in __call__
subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
env/lib/python3.7/argparse.py:1783: in parse_known_args
self.error(str(err))
env/lib/python3.7/site-packages/codalab/lib/bundle_cli.py:173: in error
self.cli.do_command(['help'])
because this line failed
...
# Bind self (BundleCLI instance) and args to command function
command_fn = lambda: args.function(self, args)
> if self.verbose >= 2:
E TypeError: '>=' not supported between instances of 'NoneType' and 'int'
This happens when I construct cli = BundleCLI(CodaLabManager(temporary=True, config={}))
for testing purpose, which sets the self.verbose
here, but codalab_manager.cli_verbose()
returns None by default here.
I can get around it by constructing cli
as below
cli = BundleCLI(
CodaLabManager(temporary=True, config={"cli": {"verbose": 0}})
)
But since self.verbose
is an int
, the .cli_verbose()
should return an int instead None. Alternatively, we should check if self.verbose
is None before doing the comparison.
Codalab Information
- Your username:
- UUID of worksheet where problem occurred:
- UUID of problem bundle (please don't delete):
- Error message received from Codalab (if applicable):
- OS (if on CLI):
- Codalab CLI Version (if on CLI):
- Browser (if on Web);
To Reproduce
N/A
Expected behavior
See above.
Screenshots
N/A
Additional context
N/A
Activity