neithere / argh

An argparse wrapper that doesn't make you say "argh" each time you deal with it.
http://argh.rtfd.org
GNU Lesser General Public License v3.0
369 stars 56 forks source link

Warnings about argcomplete (?) #62

Closed lra closed 10 years ago

lra commented 10 years ago

I get annoying warnings all the time:

$ ./blah 
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/argh/completion.py:90: UserWarning: Bash completion not available. Install argcomplete.
  warnings.warn('Bash completion not available. Install argcomplete.')
usage: blah [-h] {test} ...
blah: error: too few arguments

$ ./blah test
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/argh/completion.py:90: UserWarning: Bash completion not available. Install argcomplete.
  warnings.warn('Bash completion not available. Install argcomplete.')
test

My python script is:

#!/usr/bin/env python
import argh

def test():
    print 'test'

parser = argh.ArghParser()
parser.add_commands([test])

if __name__ == '__main__':
    parser.dispatch()

What is this warning about ? I don't really care about bash completion.

Thanks

neithere commented 10 years ago

Hi Ira,

you are correct: the warnings are irrelevant for users who don't need completion. This is a bug.

A related problem was solved in 549439eea038d2ad1c9b0e505853ca073f95303d but your use case was not addressed.

At the moment I'm not sure if the warning should be completely removed because it could be useful for debugging. Probably we should use logging and emit messages on debug level.