multimeric / ArgparsePrompt

Wrapper for the built-in Argparse, allowing missing command-line arguments to be filled in by the user via interactive prompts
GNU General Public License v3.0
11 stars 4 forks source link

secure=True does not works #8

Closed kiransterling closed 3 years ago

kiransterling commented 4 years ago

if I put

parser.add_argument('--password','-p', help='Your password',secure=True) it does not works. It does not even hides the password. Moreover if I press enter it hangs

multimeric commented 4 years ago

This works on my (Linux) machine and in the test suite. Can you show me the entire block of code you're using? Are you running Python in an unusual environment like in IDLE or somewhere that's not a terminal?

kiransterling commented 4 years ago

I am running this from pycharm in windows. I also tried it in my ubuntu box . it didn't work. It works if I remove secure=True

from argparse_prompt import PromptParser

if name == 'main': parser = PromptParser() parser.add_argument('--username','-u', help='Your username') parser.add_argument('--password','-p', help='Your password',secure=True)

args = vars(parser.parse_args()) username=args['username'] password=args['password']

kiransterling commented 4 years ago

This works on my (Linux) machine and in the test suite. Can you show me the entire block of code you're using? Are you running Python in an unusual environment like in IDLE or somewhere that's not a terminal?

I am running this from pycharm in windows. I also tried it in my ubuntu box . it didn't work. It works if I remove secure=True

from argparse_prompt import PromptParser

if name == 'main': parser = PromptParser() parser.add_argument('--username','-u', help='Your username') parser.add_argument('--password','-p', help='Your password',secure=True)

args = vars(parser.parse_args()) username=args['username'] password=args['password']

multimeric commented 4 years ago

I suspect this issue isn't related to ArgparsePrompt, but rather the underlying getpass() function. Try running getpass.getpass() in your environment, and if it fails (as I suspect it will), that may direct you to solutions online, for example this.

If you're running it from PyCharm, then you're not running it from a terminal. I'm not surprised PyCharm has some issues with getpass().

kiransterling commented 4 years ago

I suspect this issue isn't related to ArgparsePrompt, but rather the underlying getpass() function. Try running getpass.getpass() in your environment, and if it fails (as I suspect it will), that may direct you to solutions online, for example this.

If you're running it from PyCharm, then you're not running it from a terminal. I'm not surprised PyCharm has some issues with getpass().

sorry to say it doesn't works from cmd as well

multimeric commented 4 years ago

Please try out the other things I suggested. Please also describe what happens when it "doesn't work".

multimeric commented 3 years ago

Closing for insufficient information