pwinput

raw JSON →
1.0.3 verified Fri May 01 auth: no python

A cross-platform Python module that displays **** for password input. Works on Windows, unlike getpass. Formerly called stdiomask. Current version: 1.0.3, maintained by Al Sweigart, stable with low release cadence.

pip install pwinput
error ModuleNotFoundError: No module named 'stdiomask'
cause Library was renamed from stdiomask to pwinput.
fix
pip install pwinput and change import to import pwinput.
error AttributeError: module 'pwinput' has no attribute 'getpass'
cause pwinput() is the main function; there is no getpass function.
fix
Use pwinput.pwinput() instead.
error ValueError: The 'stream' argument is not supported by pwinput().
cause Some users try to pass a stream argument similar to getpass.getpass.
fix
pwinput does not support stream; remove that argument.
breaking Library renamed from stdiomask to pwinput. All old imports (import stdiomask) will break.
fix Update imports to import pwinput and use pwinput.pwinput() instead of stdiomask.maskinput() or getpass.
gotcha pwinput() returns the entered password as a string; it does not echo newline on some terminals? Actually it does print newline. But be aware that if you call pwinput() without prompt, prompt defaults to 'Password: '.
fix Use pwinput.pwinput(prompt='Enter your password: ') to customize.
gotcha On some systems, masking character may not be asterisk if locale or terminal doesn't support Unicode. It uses '*' by default.
fix Pass mask='•' to change character.

Simple password input with asterisks masking.

import pwinput
password = pwinput.pwinput(prompt='Password: ')
print('You entered:', password)