getpass echos password

Asked by Roger F Borrello Jr

I have a little snippet of code shown below, which logs me into a web page. However, the password is retrieved "in the clear".
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
import getpass

def waitText(text, time):
    while time > 0:
        match = findText(text)
        if match: return match
        time -= 1
    return null

myApp = App("chrome")
myApp.open()

type("l", Key.CTRL)
type("https://localhost:7443/gui\n")
type(Key.SPACE, Key.ALT)
type("x")

u = input('Userid: ')
p = getpass.getpass()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When this runs, the console shows:

rfb@rfb:~/projects/sikuli$ java -jar act/act_demo_about_sikuli.jar
[error] Hot key conflicts
[error] HotkeyManager: addHotkey: failed
[log] ( Ctrl ) TYPE "l"
[log] TYPE "https://localhost:7443/gui#ENTER."
[log] ( Alt ) TYPE " "
[log] TYPE "x"
Password: password <--- This is not good

I'm trying to get that password from the user without echoing it.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

has nothing to do with SikuliX - a Python problem.

try with SikuliX's input() instead:
https://sikulix-2014.readthedocs.io/en/latest/interaction.html#input

Revision history for this message
Roger F Borrello Jr (mydoll) said :
#2

Thanks RaiMan, that solved my question.