Page MenuHomePhabricator

cgi_interface fails for Python 3
Closed, ResolvedPublicBUG REPORT


>>> import pwb, pywikibot
>>> from pywikibot.userinterfaces.cgi_interface import UI
>>> ui = UI()
>>> ui.input('Hello world')
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    ui.input('Hello world')
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\", line 25, in input
    self.output(question + ' ', newline=False, toStdout=True)
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\", line 21, in output
    sys.stdout.write(text.encode('UTF-8', 'replace'))
TypeError: descriptor 'encode' for 'str' objects doesn't apply to a 'bytes' object

Event Timeline

Xqt triaged this task as Medium priority.Mar 22 2020, 9:42 AM
Xqt changed the subtype of this task from "Task" to "Bug Report".

Change 483764 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Fix unicode type error within

Change 483764 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Remove disfunctional