ConfigArgParse icon indicating copy to clipboard operation
ConfigArgParse copied to clipboard

parse_known_args() got an unexpected keyword argument 'ignore_help_args'

Open xuyumeng opened this issue 4 years ago • 3 comments

Got this error, but I can't figure out the reason. I have checked the line 457 and the parse_known_args function in the source code but they look ok. I have to delete the ignore_help_args to make it run.

 File "~/.conda/envs/bilby-td/lib/python3.9/site-packages/configargparse.py", line 457, in parse_args
    args, argv = self.parse_known_args(
TypeError: parse_known_args() got an unexpected keyword argument 'ignore_help_args'

xuyumeng avatar May 25 '21 07:05 xuyumeng

What version of configargparse do you have installed? The latest version (v1.4.1) supports ignore_help_args:

~$ python3 -m pip freeze | grep Config
ConfigArgParse==1.4.1
~$ ipython3
Python 3.7.10 (default, Apr 27 2021, 08:48:55)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import configargparse

In [2]: p = configargparse.ArgumentParser()

In [3]: p.parse_known_args(ignore_help_args=True)
Out[3]: (Namespace(), [])

In [4]: p.parse_known_args(ignore_help_args=False)
Out[4]: (Namespace(), [])

bw2 avatar May 25 '21 14:05 bw2

If you're still getting the error after uninstalling / reinstalling configargparse, please post your exact python version, and code snippet for reproducing the issue.

bw2 avatar May 25 '21 14:05 bw2

Hi, the version I'm using is v1.4.1 and

~$ ipython3
Python 3.9.4 | packaged by conda-forge | (default, May 10 2021, 22:13:33)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.23.1 -- An enhanced Interactive Python. Type '?' for help.

The error occurred when I was using parallel_bilby_generation command from parallel_bilby, it works fine with v1.4

~$ parallel_bilby_generation config.ini
Traceback (most recent call last):
  File "/home/**/.conda/envs/bilby-td/bin/parallel_bilby_generation", line 10, in <module>
    sys.exit(main())
  File "/home/**/.conda/envs/bilby-td/lib/python3.9/site-packages/parallel_bilby/generation.py", line 66, in main
    args = generation_parser.parse_args(args=cli_args)
  File "/home/**/.conda/envs/bilby-td/lib/python3.9/site-packages/configargparse.py", line 457, in parse_args
    args, argv = self.parse_known_args(
TypeError: parse_known_args() got an unexpected keyword argument 'ignore_help_args'

You can try with any empty config.ini

This error looks nonsense from the code. I really don't know why it happened.

xuyumeng avatar May 26 '21 07:05 xuyumeng