Skip to content

Commit 89f8c3a

Browse files
committed
Settings: Python 3.8 does not have ArgumentParser(exit_on_error=False)
1 parent a900403 commit 89f8c3a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cratedb_toolkit/util/setting.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,13 @@ def obtain_setting_cli(
104104
"""
105105
Obtain a command line argument value from `sys.argv`.
106106
"""
107-
parser = argparse.ArgumentParser(exit_on_error=False)
107+
parser = argparse.ArgumentParser()
108108
arg = parser.add_argument(name, default=default, help=help)
109-
namespace, args = parser.parse_known_args()
110-
return parser, getattr(namespace, arg.dest)
109+
try:
110+
namespace, args = parser.parse_known_args()
111+
return parser, getattr(namespace, arg.dest)
112+
except argparse.ArgumentError:
113+
return parser, None
111114

112115

113116
def argv_has_long_option() -> bool:

0 commit comments

Comments
 (0)