bw2 / ConfigArgParse

A drop-in replacement for argparse that allows options to also be set via config files and/or environment variables.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

argparse `MetavarTypeHelpFormatter` not available in ConfigArgParse

cruisen opened this issue · comments

Missing Formater

MetavarTypeHelpFormatter is part of argparse

Error

  • However MetavarTypeHelpFormatter is not available in ConfigArgParse

  • It actually fails on import:
    ImportError: cannot import name 'MetavarTypeHelpFormatter' from 'configargparse'

PR wanted?

Note

  • As a side effect I found a bug on argparse itself. It fails if MetavarTypeHelpFormatter is used and an argument does not have an type argument:
    AttributeError: 'NoneType' object has no attribute '__name__'
  • I will raise an Issue, maybe a PR there as well.

This was an issue on my misunderstanding. Hence a user error.

Fix is:

from argparse import MetavarTypeHelpFormatter

-> Closing the issue.