data hiding for python QTconsole
Asked Answered
P

0

5

Currently I am making an image authentication project in which I need to authenticate an image with the help of a key. I am taking the key as a raw_input from the user through the IPython console. I want to hide the key being entered.

Expected Result:

Enter the key = ***** or Enter the key = (nothing shown)

I found getpass() method for hiding the entered data but it gives the following warning on my PC: Warning: QtConsole does not support password mode, the text you type will be visible.

I even saw this code:

import sys
import msvcrt

passwor = ''
while True:
    x = msvcrt.getch()
    if x == '\r':
        break
    sys.stdout.write('*')
    passwor +=x

print '\n'+passwor

But this prints infinite number of asterisks on the display.

Please let me know some solution for this problem.

Pressing answered 22/8, 2017 at 10:14 Comment(4)
getpass works out of Spyder. This is a limitation of Spyder/QtConsole, not of getpass itself.Severen
@CarlosCordoba thanks. But do you know any function or code that could suffice my need?Pressing
Not that will run inside Spyder. You can go to Run > Configuration per file > Console and select the option called Execute in an external terminal to use an external terminal instead.Severen
Please see a workaround in linked question, and if you can, please add the Windows-specific basic GUI commands in Option 1.Dorso

© 2022 - 2024 — McMap. All rights reserved.