Page MenuHomePhabricator

cgi_interface fails for Python 3
Closed, ResolvedPublicBUG REPORT

Description

>>> 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\cgi_interface.py", line 25, in input
    self.output(question + ' ', newline=False, toStdout=True)
  File "C:\pwb\GIT\core\pywikibot\userinterfaces\cgi_interface.py", 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 created this task.Mar 22 2020, 8:28 AM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptMar 22 2020, 8:28 AM
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 cgi_interface.py

https://gerrit.wikimedia.org/r/483764

Xqt moved this task from Backlog to Needs Review on the Pywikibot board.Mar 22 2020, 9:55 AM

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

https://gerrit.wikimedia.org/r/483764

Xqt closed this task as Resolved.Mar 23 2020, 11:08 AM