jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] UI: Ensure printing message before querying ......................................................................
[FIX] UI: Ensure printing message before querying
In Python (at least 3.4.2), the message doesn't get flushed before the getpass call, so that the user doesn't get any question and any inputs will be invisible. It only gets visible after exiting the getpass call.
Bug: T90338 Change-Id: Ie19239bca1ba5fad510d8a03bf248b6a6819d0a8 --- M pywikibot/userinterfaces/terminal_interface_base.py 1 file changed, 7 insertions(+), 3 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py index 0ca9028..d6b9ba2 100755 --- a/pywikibot/userinterfaces/terminal_interface_base.py +++ b/pywikibot/userinterfaces/terminal_interface_base.py @@ -7,10 +7,12 @@ # __version__ = '$Id$'
-from . import transliteration +import getpass +import logging import re import sys -import logging + +from . import transliteration import pywikibot from pywikibot import config from pywikibot.bot import VERBOSE, INFO, STDOUT, INPUT, WARNING @@ -210,7 +212,9 @@ self.output(question + ' ') try: if password: - import getpass + # Python 3 requires that stderr gets flushed, otherwise is the + # message only visible after the query. + self.stderr.flush() text = getpass.getpass('') else: text = self._raw_input()
pywikibot-commits@lists.wikimedia.org