jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/367493 )
Change subject: welcome.py: TypeError: decoding str is not supported
......................................................................
welcome.py: TypeError: decoding str is not supported
Fix "TypeError: decoding str is not supported" (python3).
Bug: T171051
Change-Id: I8513da1dace94294f983af72dd181dad853e6cdb
---
M scripts/welcome.py
1 file changed, 5 insertions(+), 8 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 7297944..977923c 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -180,10 +180,7 @@
from pywikibot import config, i18n
from pywikibot.tools.formatter import color_format
-from pywikibot.tools import issue_deprecation_warning
-
-if sys.version_info[0] > 2:
- unicode = str
+from pywikibot.tools import issue_deprecation_warning, UnicodeType
locale.setlocale(locale.LC_ALL, '')
@@ -831,10 +828,10 @@
if globalvar.recursive:
showStatus()
if locale.getlocale()[1]:
- strfstr = unicode(
- time.strftime(u"%d %b %Y %H:%M:%S (UTC)",
- time.gmtime()),
- locale.getlocale()[1])
+ strfstr = time.strftime(
+ '%d %b %Y %H:%M:%S (UTC)', time.gmtime())
+ if not isinstance(strfstr, UnicodeType): # py2-py3
compatibility
+ strfstr = strfstr.decode(locale.getlocale()[1])
else:
strfstr = time.strftime(
u"%d %b %Y %H:%M:%S (UTC)", time.gmtime())
--
To view, visit
https://gerrit.wikimedia.org/r/367493
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8513da1dace94294f983af72dd181dad853e6cdb
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>