XZise has uploaded a new change for review.
https://gerrit.wikimedia.org/r/192206
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(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/06/192206/1
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()
--
To view, visit https://gerrit.wikimedia.org/r/192206
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie19239bca1ba5fad510d8a03bf248b6a6819d0a8
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits